Code:MyObject myObj = new MyObject(); Type myObjType = typeof(MyObject); foreach(PropertyInfo pi in myObjType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty)) { string name = pi.Name; object value = pi.GetValue(myObj, null); }




Reply With Quote