Changeset 15018 for branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
- Timestamp:
- 06/01/17 11:29:49 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r14928 r15018 50 50 51 51 [StorableConstructor] 52 private StorableSerializer( booldeserializing) : this() { }52 private StorableSerializer(StorableConstructorFlag deserializing) : this() { } 53 53 54 54 #region ICompositeSerializer implementation … … 241 241 .Where(ci => ci.GetCustomAttributes(typeof(StorableConstructorAttribute), false).Length > 0)) { 242 242 if (ci.GetParameters().Length != 1 || 243 ci.GetParameters()[0].ParameterType != typeof( bool))244 throw new PersistenceException("StorableConstructor must have exactly one argument of type bool");243 ci.GetParameters()[0].ParameterType != typeof(StorableConstructorFlag)) 244 throw new PersistenceException("StorableConstructor must have exactly one argument of type StorableConstructorFlag"); 245 245 var dm = new DynamicMethod("", typeof(object), null, type, true); 246 246 var ilgen = dm.GetILGenerator(); 247 ilgen.Emit(OpCodes.Ldc_I4_1); // load true 247 var local = ilgen.DeclareLocal(typeof(StorableConstructorFlag)); 248 ilgen.Emit(OpCodes.Ldloca_S, local); 249 ilgen.Emit(OpCodes.Initobj,typeof(StorableConstructorFlag)); // load default value for StorableConstructorFlag 250 ilgen.Emit(OpCodes.Ldloc_0); 248 251 ilgen.Emit(OpCodes.Newobj, ci); 249 252 ilgen.Emit(OpCodes.Ret);
Note: See TracChangeset
for help on using the changeset viewer.