private object[] ReadSimpleArrayProperty(string path, string collectionElementProperty, Type type, object obj, int i, int j) { object[] matrixValue = SensorsUtility.GetArrayProperty(path, collectionElementProperty, type, obj, i, j);//matrixValue[0] is the actual matrix, matrixValue[1] is the Property object[] toReturn = new object[4]; if (matrixValue[0] != null && matrixValue[1] != null) { MyDebugger.MyDebug("READING THE MATRIX!"); FieldOrProperty toRead = (FieldOrProperty)matrixValue[1]; Array matrix = (Array)matrixValue[0]; toReturn[0] = toRead.GetValue(matrix.GetValue(i, j)).GetType(); //Property type of the element of the collection toReturn[1] = matrix.GetLength(0); toReturn[2] = matrix.GetLength(1); toReturn[3] = matrix.GetValue(i, j).GetType(); //Collection Element Type MyDebugger.MyDebug("LENGTH " + toReturn[1] + " " + toReturn[2]); return(toReturn); } else if (matrixValue[0] != null) { toReturn[1] = 0; toReturn[2] = 0; toReturn[3] = matrixValue[0].GetType().GetGenericArguments()[0]; foreach (FieldOrProperty member in ReflectionExecutor.GetFieldsAndProperties(toReturn[3])) { if (member.Name().Equals(currentSubProperty)) { toReturn[0] = member.Type(); return(toReturn); } } } return(null); }
private object[] ReadSimpleListProperty(string path, string collectionElementProperty, Type type, object obj, int i) { object[] toReturn = new object[3]; object[] listValue = SensorsUtility.GetListProperty(path, collectionElementProperty, type, obj, i); if (listValue[0] != null && listValue[1] != null) { FieldOrProperty toRead = (FieldOrProperty)listValue[1]; IList list = (IList)listValue[0]; toReturn[0] = toRead.GetValue(list[i]).GetType(); //Property type of the element of the collection toReturn[1] = list.Count; toReturn[2] = list[i].GetType(); //Collection Element Type return(toReturn); } else if (listValue[0] != null) { toReturn[1] = 0; toReturn[2] = listValue[0].GetType().GetGenericArguments()[0]; foreach (FieldOrProperty member in ReflectionExecutor.GetFieldsAndProperties(toReturn[2])) { if (member.Name().Equals(currentSubProperty)) { toReturn[0] = member.Type(); return(toReturn); } } } return(null); }
public List <FieldOrProperty> GetFieldsAndProperties(object gO) { return(re.GetFieldsAndProperties(gO)); }
public List <FieldOrProperty> GetFieldsAndProperties(object gO) { return(ReflectionExecutor.GetFieldsAndProperties(gO)); }