Ejemplo n.º 1
0
 public ISerializer Find(Reflect.Type type, bool deserialize)
 {
     ISerializer result = null;
     if (type.NotNull())
     {
         if (this.cache[deserialize ? 1 : 0].Contains(type))
             result = this.cache[deserialize ? 1 : 0][type];
         else
         {
             MethodAttribute[] attributes;
             if (type.Category != Reflect.TypeCategory.Primitive && (attributes = type.GetAttributes<MethodAttribute>()).Length == 1)
                 result = attributes[0].Serializer;
             else
                 result = serializer.Find(type, deserialize);
             if (result.NotNull())
                 this.cache[deserialize ? 1 : 0][type] = result;
         }
     }
     return result;
 }