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 us
Not quite the question asked - but here's how to get the values of all properties of type Decimal from an object called "inv":
var properties = inv.GetType().GetProperties();
foreach (var prop in properties)
{
if (prop.ToString().ToLower().Contains("decimal"))
{
totalDecimal += (Decimal)prop.GetValue(inv, null);
}
}