本文整理汇总了C#中Newtonsoft.Json.Linq.JObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.GetType方法的具体用法?C# JObject.GetType怎么用?C# JObject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.Linq.JObject
的用法示例。
在下文中一共展示了JObject.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getKeys
public static string getKeys(JObject jo,string prekey)
{
string ret="";
Dictionary<string, object> dc = jo.ToObject<Dictionary<string, object>>();
foreach (string key in dc.Keys)
{
if (Object.ReferenceEquals(dc[key].GetType(), jo.GetType()))
{
if (prekey == "")
ret += getKeys((JObject)dc[key], key);
else ret += getKeys((JObject)dc[key], prekey + "_" + key);
}
else
{
if (prekey == "")
{
ret += "`" + key + "`" + ",";
}
else
{
ret += "`" + prekey + "_" + key + "`" + ",";
}
}
}
return ret;
}
示例2: convertJobjectToType
private object convertJobjectToType(JObject jo, Type t)
{
MethodInfo mi = jo.GetType().GetMethod("ToObject", new Type[] { });
MethodInfo gmi = mi.MakeGenericMethod(t);
return gmi.Invoke(jo, new object[] { });
}
示例3: getValues
public static string getValues(JObject jo)
{
string ret = "";
Dictionary<string, object> dc = jo.ToObject<Dictionary<string, object>>();
foreach (string key in dc.Keys)
{
if (Object.ReferenceEquals(dc[key].GetType(), jo.GetType()))
{
ret += getValues((JObject)dc[key]);
}
else ret += "'"+dc[key].ToString()+"'"+",";
}
return ret;
}