本文共 692 字,大约阅读时间需要 2 分钟。
public class User { private string id; public string Id { get { return id; } set { id = value; } } private string name; public string Name { get { return name; } set { name = value; } } } |
private PropertyInfo[] GetPropertyInfoArray() { PropertyInfo[] props = null; try { Type type = typeof(User); object obj = Activator.CreateInstance(type); props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); } catch (Exception ex) { } return props; } |
转载于:https://www.cnblogs.com/liusuqi/p/3171963.html