Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/27/09 13:45:33 (15 years ago)
Author:
epitzer
Message:

refactoring and code clean up. (#9999)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/New Persistence Exploration/Persistence/Persistence/Core/DeSerializer.cs

    r1437 r1447  
    1818
    1919    public void AddValue(string name, object value, List<Thunk> finalFixes) {
    20       Tag t = new Tag(name, value);
    21       t.finalFixes = finalFixes;
     20      Tag t = new Tag(name, value) {finalFixes = finalFixes};
    2221      customValues.Add(t);
    2322    }
     
    4847
    4948    private Dictionary<Type, object> createSerializers(IEnumerable<TypeMapping> typeCache) {
    50       var serializerMapping = new Dictionary<Type, object>();
     49      var map = new Dictionary<Type, object>();
    5150      foreach (var typeMapping in typeCache) {
    5251        Type type = Type.GetType(typeMapping.TypeName);
     
    5453        if (typeMapping.Serializer != null) {
    5554          Type serializerType = Type.GetType(typeMapping.Serializer);
    56           serializerMapping.Add(type, Activator.CreateInstance(serializerType, true));
     55          map.Add(type, Activator.CreateInstance(serializerType, true));
    5756        }
    5857      }
    59       return serializerMapping;
     58      return map;
    6059    }
    6160
     
    9392          "No suitable method for deserialization of type \"{0}\" found.",
    9493          type.VersionInvariantName()));
    95       object instance = decomposer.CreateInstance(type);
    96       if (instance == null)
    97         instance = new ParentReference();
     94      object instance =
     95        decomposer.CreateInstance(type) ??
     96        new ParentReference();
    9897      parentStack.Push(new CompositeObject(instance));             
    9998      if ( token.Id != null )
     
    110109          "No suitable method for deserialization of type \"{0}\" found.",
    111110          type.VersionInvariantName()));
    112       CompositeObject customComposite = (CompositeObject)parentStack.Pop();
     111      CompositeObject customComposite = parentStack.Pop();
    113112      object deserializedObject =         
    114113        decomposer.Populate(customComposite.Obj, customComposite.customValues, type);
Note: See TracChangeset for help on using the changeset viewer.