How to list all Variables of Class

Viewed 94626

Is there a way to list all Variables (Fields) of a class in C#. If yes than could someone give me some examples how to save them in a List and get them maybe using Anonymous Types (var).

6 Answers
var fields = yourClass.GetType().GetProperties().Select(x => x.Name).ToList()
Related