Changeset 2991 for trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
- Timestamp:
- 03/10/10 15:27:10 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r2990 r2991 19 19 if (!ReflectionTools.HasDefaultConstructor(type)) 20 20 return false; 21 while (type != null) { 21 while (type != null) { 22 22 if (StorableAttribute.GetStorableMembers(type, false).Count() == 0 && 23 23 !EmptyStorableClassAttribute.IsEmptyStorable(type)) … … 39 39 } 40 40 41 private static readonly object[] defaultArgs = new object[] { true }; 42 41 43 public object CreateInstance(Type type, IEnumerable<Tag> metaInfo) { 42 44 try { 43 object instance = StorableConstructorAttribute.CallStorableConstructor(type); 44 if (instance == null) 45 instance = Activator.CreateInstance(type, true); 46 return instance; 45 ConstructorInfo constructor = StorableConstructorAttribute.GetStorableConstructor(type); 46 return constructor != null ? constructor.Invoke(defaultArgs) : Activator.CreateInstance(type, true); 47 47 } catch (TargetInvocationException x) { 48 48 throw new PersistenceException(
Note: See TracChangeset
for help on using the changeset viewer.