Ejemplo n.º 1
0
        internal static string SerializeBaseType(object thing, Type type, FileStyle style)
        {
            if (BaseSerializeMethods.TryGetValue(type, out var method))
            {
                return(method(thing));
            }

            if (BaseStyledSerializeMethods.TryGetValue(type, out var stylemethod))
            {
                return(stylemethod(thing, style));
            }

            if (type.IsEnum)
            {
                return(SerializeEnum(thing, style));
            }

            throw new Exception($"Cannot serialize base type {type} - are you sure it is a base type?");
        }