let's say I have a list of decimals:
List<decimal> values;
and 2 to display the decimal:
string DisplayPct(decimal pct) { return pct.ToString("0.00 %"); } string DisplayValue(decimal val) { return val.ToString("0.00"); }
What would be the best mechanism to implement so that I can know which function to call depending on the value?
I would like to have, for example, typedefs in C #. That way, I could declare a Percent type and a Decimal type, which both would represent decimal values, but then I could know how to display a value based on its type.
Any equivalent in c #?
thanks
source share