public static object Get(object obj, string vName) { object ret = null; if (obj == null) { return(ret); } Type vType = obj.GetType(); if (vType.IsValueType || vType.IsEnum) { ret = null; } else if (obj is IDictionary) { ret = DictionaryHelper.Get(obj as IDictionary, vName); } else if (obj is DataRow) { return(RowHelper.Get(obj as DataRow, vName)); } //else if (obj is JObject) //{ // return Get((obj as JObject)[vName]); //} else if (vType.IsClass) { PropertyInfo pro = vType.GetProperty(vName); if (pro != null) { ret = pro.GetValue(obj, null); } else { FieldInfo fie = vType.GetField(vName); if (fie != null) { ret = fie.GetValue(obj); } } } if (ret != null) { Type vAttrType = ret.GetType(); Type vGenType = null; if (vAttrType.IsGenericType) { vGenType = ret.GetType().GetGenericArguments()[0]; } //if (ret is JArray || // ret is ArrayList || // (vGenType != null && (vGenType == typeof(JObject) || vGenType.FullName == "System.Object"))) //{ // IList vInputList = ret as IList; // IList vList = ConvertList(vInputList); // if (!(obj is JObject)) // { // Set(obj, vName, vList); // } // ret = vList; //} //else if (ret is JObject) //{ // ret = DictionaryHelper.ConvertDictionary(ret); //} } return(ret); }