示例#1
0
        public SerializationLibrary(SerializationLibrary base_lib)
        {
            BaseLibrary = base_lib;
            ReadOnly    = false;


            DefaultSerializers = new List <ISerializer>();
            Serializers        = new HashSet <ISerializer>();
            TypeDeserializers  = new Dictionary <Type, ISerializer>();
            TypeSerializers    = new Dictionary <Type, ISerializer>();
        }
示例#2
0
        private SerializationLibrary(SerializationLibrary lib, bool read)
        {
            DefaultSerializers = new List <ISerializer>(lib.DefaultSerializers);

            Serializers = new HashSet <ISerializer>(lib.Serializers);

            if (ReadOnly = read)
            {
                Serializers.TrimExcess();
            }

            TypeDeserializers = new Dictionary <Type, ISerializer>(lib.TypeDeserializers);
            TypeSerializers   = new Dictionary <Type, ISerializer>(lib.TypeSerializers);

            if (!lib.BaseLibrary?.ReadOnly ?? false)
            {
                BaseLibrary = new SerializationLibrary(lib.BaseLibrary, true);
            }
            else
            {
                BaseLibrary = lib.BaseLibrary;
            }
        }
 internal SerializationInstance(SerializationLibrary lib, StreamingContext context)
 {
     Library = lib;
     Context = context;
 }