public static IClrObjMappingModel EnumerateList(ClrObject clrObject, ModelMapperFactory factory) { var result = new ArrayMappingModel { Obj = clrObject }; ClrObject fld = clrObject.GetRefFld("_items"); if (fld.Type == null) { return(result); } ClrType tp = fld.Type.ComponentType; if ((!tp.IsValueClass) && (!tp.IsString)) { // TODO: add support of reading strings. List <ClrObject> enumeration = ClrCollectionHelper.EnumerateListOfRefTypes(clrObject); foreach (ClrObject o in enumeration) { IClrObjMappingModel model = factory.BuildModel(o); result.Elements.Add(model); } } return(result); }
public static IDList Read(ClrObject obj) { if (obj.IsNullObj) { return(null); } ClrObject idsRef = obj.GetRefFld("m_ids"); if (idsRef.IsNullObj) { return(null); } List <ClrObject> ids = idsRef.Type?.Name?.Contains("ArrayList") == true?ClrCollectionHelper.EnumerateArrayList(idsRef) : ClrCollectionHelper.EnumerateListOfRefTypes(idsRef); var res = new IDList(); foreach (ClrObject id in ids) { res.Add(IDReader.Read(id)); } return(res); }