예제 #1
0
        private static string GetString(object value)
        {
            Type type = value.GetType();

            if (type.IsEnum)
            {
                KmlElementAttribute att = TypeBrowser.GetEnum((Enum)value);
                if (att != null)
                {
                    return(att.ElementName);
                }
            }
            return(string.Format(KmlFormatter.Instance, "{0}", value));
        }
예제 #2
0
        private string GetString(object value)
        {
            TypeInfo typeInfo = value.GetType().GetTypeInfo();

            if (typeInfo.IsEnum)
            {
                KmlElementAttribute att = TypeBrowser.GetEnum((Enum)value);
                if (att != null)
                {
                    return(att.ElementName);
                }
            }

            if (((this.Options & SerializerOptions.ReadableFloatingPoints) != 0) &&
                (value is double || value is float))
            {
                return(string.Format(KmlFormatter.Instance, "{0:G}", value));
            }
            else
            {
                return(string.Format(KmlFormatter.Instance, "{0}", value));
            }
        }