예제 #1
0
        public T[] Deserialize()
        {
            // Serializer info for the element
            BaseSerializerInfo <T> serializerInfo = (WKTSerializationFactory.GetSerializersForType(typeof(T).TypeHandle) as BaseSerializerInfo <T>);

            switch (serializerInfo.SerializerKind)
            {
            case SerializerKind.Normal:
                return(DeserializeInternal(serializerInfo));

            case SerializerKind.CachedVal:
                return(DeserializeInternal(serializerInfo, (this.SerializerStorage as Serializer).ValObjectsCache));

            case SerializerKind.CachedRef:
                return(DeserializeInternal(serializerInfo, (this.SerializerStorage as Serializer).RefObjectsCache));
            }

            return(null);
        }
예제 #2
0
        // Serialization of simple elements, that doesn't use caching
        public void Serialize(T[] valueToSerialize)
        {
            // Serializer info for the element
            BaseSerializerInfo <T> serializerInfo = (WKTSerializationFactory.GetSerializersForType(typeof(T).TypeHandle) as BaseSerializerInfo <T>);

            switch (serializerInfo.SerializerKind)
            {
            case SerializerKind.Normal:
                SerializeInternal(valueToSerialize, serializerInfo);
                return;

            case SerializerKind.CachedVal:
                SerializeInternal(valueToSerialize, serializerInfo, (this.SerializerStorage as Serializer).ValObjectsCache);
                return;

            case SerializerKind.CachedRef:
                SerializeInternal(valueToSerialize, serializerInfo, (this.SerializerStorage as Serializer).RefObjectsCache);
                return;
            }
        }