private SerializeValue ( object value ) : void | ||
value | object | |
Résultat | void |
private void SerializeValue(object value)
{
if (value == null)
{
this.builder.Append("null");
}
else
{
string str = value as string;
if (str != null)
{
this.SerializeString(str);
}
else if (value is bool)
{
this.builder.Append(!((bool) value) ? "false" : "true");
}
else
{
IList anArray = value as IList;
if (anArray != null)
{
this.SerializeArray(anArray);
}
else
{
IDictionary dictionary = value as IDictionary;
if (dictionary != null)
{
this.SerializeObject(dictionary);
}
else if (value is char)
{
this.SerializeString(new string((char) value, 1));
}
else
{
this.SerializeOther(value);
}
}
}
}
}
}
public static string Serialize(object obj) { Json.Serializer serializer1 = new Json.Serializer(); serializer1.SerializeValue(obj); return(serializer1.builder.ToString()); }