I have a class which contains multiple properties of type Int32:
public class MyClass
{
public int C1 { get; set; }
public int C2 { get; set; }
public int C3 { get; set; }
.
.
.
public int Cn { get; set; }
}
I want to sum all this properties. Instead of doing:
int sum = C1 + C2 + C3 + ... + Cn
is there a more efficient/elegant method?
You can fake it, but I’m not sure how useful it is: