public static object ReadAsObject <T>(ReaderState reader, SerializedType valueType)
        {
            switch (valueType)
            {
            case SerializedType.Null:
                return(null);

            case SerializedType.CustomObject:
                var identifier = Deserializer.ReadValue(reader);
                return(TypedDeserializer.ReadObject <T>(reader, identifier));

            case SerializedType.Object:
                return(TypedDeserializer.ReadObject <T>(reader));

            case SerializedType.Dictionary:
                return(TypedDeserializer.ReadDictionary <T>(reader));

            case SerializedType.List:
                return(TypedDeserializer.ReadList <T>(reader));

            case SerializedType.HList:
                return(TypedDeserializer.ReadHList <T>(reader));

            case SerializedType.Enumerable:
                return(TypedDeserializer.ReadEnumerable <T>(reader));

            case SerializedType.HEnumerable:
                return(TypedDeserializer.ReadHEnumerable <T>(reader));

            default:
                return(ReadAsMiscObject <T>(reader, valueType));
            }
        }
                public object Handle(ReaderState reader)
                {
                    var valueType = Reader.ReadSerializedType(reader);

                    switch (valueType)
                    {
                    case SerializedType.Null:
                        return(null);

                    case SerializedType.CustomObject:
                        var identifier = Deserializer.ReadValue(reader);
                        return(TypedDeserializer.ReadObject <T>(reader, identifier));

                    case SerializedType.Object:
                        return(TypedDeserializer.ReadObject <T>(reader));

                    case SerializedType.Dictionary:
                        return(TypedDeserializer.ReadDictionary <T>(reader));

                    case SerializedType.List:
                        return(TypedDeserializer.ReadList <T>(reader));

                    case SerializedType.HList:
                        return(TypedDeserializer.ReadHList <T>(reader));

                    case SerializedType.Enumerable:
                        return(TypedDeserializer.ReadEnumerable <T>(reader));

                    case SerializedType.HEnumerable:
                        return(TypedDeserializer.ReadHEnumerable <T>(reader));

                    case SerializedType.String:
                        return(Reader.ReadString(reader));

                    case SerializedType.Char:
                        return(Reader.ReadChar(reader));

                    case SerializedType.Byte:
                        return(Reader.ReadByte(reader));

                    case SerializedType.SByte:
                        return(Reader.ReadSByte(reader));

                    case SerializedType.UShort:
                        return(Reader.ReadUShort(reader));

                    case SerializedType.Short:
                        return(Reader.ReadShort(reader));

                    case SerializedType.UInt:
                        return(Reader.ReadUInt(reader));

                    case SerializedType.Int:
                        return(Reader.ReadInt(reader));

                    case SerializedType.ULong:
                        return(Reader.ReadULong(reader));

                    case SerializedType.Long:
                        return(Reader.ReadLong(reader));

                    case SerializedType.Float:
                        return(Reader.ReadFloat(reader));

                    case SerializedType.Double:
                        return(Reader.ReadDouble(reader));

                    case SerializedType.Decimal:
                        return(Reader.ReadDecimal(reader));

                    case SerializedType.Bool:
                        return(Reader.ReadBool(reader));

                    case SerializedType.DateTime:
                        return(Reader.ReadDateTime(reader));

                    case SerializedType.Guid:
                        return(Reader.ReadGuid(reader));

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }