in below code "YourType" will be your class name of which fields name list you want.
for vs2008:
var fields = typeof(YourType).GetFields(
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
var names = Array.ConvertAll(fields, field => field.Name);
for vs2005:
FieldInfo[] fields = typeof(YourType).GetFields(
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
string[] names = Array.ConvertAll
delegate(FieldInfo field) { return field.Name; });
No comments:
Post a Comment