Example I've got my class Widgits
public class Widgits
{
public string Type { get; set; }
public string Color { get; set; }
public string Weight { get; set; }
public string TotalHeight { get; set; }
public string TotalWidth { get; set; }
public string TotalLength { get; set; }
public string Material { get; set; }
}
And Via this I can assign the values as
Widgits myWidgit = new Widgits();
and the values then as
myWidgit.Color = "Blue";
mywidgit.Material = "Unobatanium";
ect...
But isn't their a way to have it also return
string VarableName = mywidgit.TotalHeight .???? to Get VarableName = "Total Height" ? Or what ever I code it to?
Reason is I'm trying to go through all assigned values of a Class, and get a descriptor of the variable along with the value itself. The Descriptors would be fixed, the value can be adjusted as needed.


Sign In
Create Account


Back to top









