private static int Sort(FiledPropObject x, FiledPropObject y) { return x.offset - y.offset; }
private static List<FiledPropObject> AutoFindProp(Type obj) { TemplateVOType = obj.Name; var list = new List<FiledPropObject>(); var props = obj.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); //| BindingFlags.DeclaredOnly foreach (var prop in props) { var attrs = prop.GetCustomAttributes(typeof(ExcelCellBindingAttribute), false); if (attrs.Length > 0) { var filedObj = new FiledPropObject { type = prop.FieldType.Name, name = prop.Name, offset = (attrs[0] as ExcelCellBindingAttribute).offset }; list.Add(filedObj); //Debug.Log(prop.FieldType.Name); } } list.Sort(Sort); return list; }