示例#1
0
        /// <exception cref="SerializationException">An object in the graph of type parameter <typeparamref name="T"/> is not marked as serializable.</exception>
        private T ReadObject(int len)
        {
            var data = new byte[len];

            BaseStream.Read(data, 0, len);
            return(_serializer.Deserialize(data));
        }
        public ReturnType Deserialize <ReturnType>(string pathToFile) where ReturnType : class
        {
            string            extension    = pathToFile.Split('.')[1];
            ICustomSerializer deserializer = GetDeserializer(extension);
            object            result       = deserializer.Deserialize(pathToFile);

            return(result as ReturnType);
        }
示例#3
0
 public Source Deserialize()
 {
     return(customDataContractSerializer.Deserialize <string, Source>(SerializerData));
 }