예제 #1
0
        public static object Deserialize(this byte[] data, Type objectType)
        {
            object result;

            using (var reader = SerializationReader.CreateReader(data))
            {
                result = reader.ReadObject(objectType, ObjectTypeCode.Object, false);
            }
            return(result);
        }
예제 #2
0
        public static T Deserialize <T>(this byte[] data)
            where T : class
        {
            T result;

            using (var reader = SerializationReader.CreateReader(data))
            {
                result = (T)reader.ReadObject(typeof(T), ObjectTypeCode.Object, false);
            }
            return(result);
        }
예제 #3
0
 public static SerializationReader CreateReader(SerializationInfo info)
 {
     byte[] buffer = (byte[])info.GetValue("X", typeof(byte[]));
     return(SerializationReader.CreateReader(buffer));
 }