public T[] ReadFromJSONObject <T>(object jObjs) { int size; if (jObjs is Dictionary <string, object> ) { size = 1; } else if (jObjs is System.Collections.IList) { size = (jObjs as System.Collections.IList).Count; } else if (jObjs.GetType().IsArray) { size = (jObjs as object[]).Length; } else { throw new Exception( @"Wrong json object format.Must be List<Dictionary<stirng,object>> or Dictionary<string,object>.But was " + jObjs.GetType().Name); } T[] objects = ReflectionSupport.CreateNewInstances <T>(size); LoadFromJSONObject <T>(jObjs, objects, 0, size); return(objects); }
public T[] Get <T>(DataTable result, ClassDesc desc) { T[] objects = ReflectionSupport.CreateNewInstances <T>(result.Rows.Count); SetTo(result, 0, desc, objects, 0, objects.Length); return(objects); }