Common/JSON.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using System.IO;
namespace fastJSON
{
public class JSON
{
public readonly static JSON Instance = new JSON();
private JSON()
{
}
public string ToJSON(object obj)
{
return new JSONSerializer().ConvertToJSON(obj);
}
public object ToObject(string json)
{
Dictionary<string, object> ht = (Dictionary<string, object>)JsonParser.JsonDecode(json);
if (ht == null)
return null;
//add by kaixin001
return ht;
//return ParseDictionary(ht);
}
#region [ PROPERTY GET SET CACHE ]
SafeDictionary<string, Type> _typecache = new SafeDictionary<string, Type>();
private Type GetTypeFromCache(string typename)
{
if (_typecache.ContainsKey(typename))
return _typecache[typename];
else
{
Type t = Type.GetType(typename);
_typecache.Add(typename, t);
return t;
}
}
SafeDictionary<string, PropertyInfo> _propertycache = new SafeDictionary<string, PropertyInfo>();
private PropertyInfo getproperty(Type type, string propertyname)
{
if (propertyname == "$type")
return null;
StringBuilder sb = new StringBuilder();
sb.Append(type.Name);
sb.Append("|");
sb.Append(propertyname);
string n = sb.ToString();
后面还有 276 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。