Пример #1
0
        public static T Deserialize <T>(this TimeoutCommand command)
        {
            var state = default(T);

            if (command.TryDeserialize(out state))
            {
                return(state);
            }

            throw new SerializationException($"{command.DataType} can't be deserialized into {typeof(T).FullName}");
        }
Пример #2
0
        public static T Deserialize <T>(this TimeoutCommand command)
        {
            var state = default(T);

            if (command.TryDeserialize(out state))
            {
                return(state);
            }

            throw new SerializationException(string.Format("{0} can't be deserialized into {1}", command.DataType, typeof(T).FullName));
        }
Пример #3
0
        public static bool TryDeserialize <T>(this TimeoutCommand command, out T state)
        {
            var expectedDataType = typeof(T).FullName;

            if (expectedDataType != command.DataType)
            {
                state = default(T);
                return(false);
            }

            state = (T)Deserialize(command);
            return(true);
        }
Пример #4
0
 public static object Deserialize(TimeoutCommand command)
 {
     return(Deserialize(command.Data, command.DataType));
 }