I have got a class which contains more then 150 fields. i need the name of fields (not value) in an array.
because its very hard and not a good approach to write 150
Worked for me
var t = typeof(YOURTYPE); var allfieldNames = new List(t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Select(x => x.Name));
// t for Type