Hello,
let's say I have a list of decimals :
List<decimal> values;
and 2 function to display a 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 I could know which function to call depending on the value?
I would have liked to have for instance typedefs in C#. That way, I could have declared a type Percent and a type Decimal that would both represent decimal values, but then I could know how to display the value based on its type.
Any equivalent in C# ?
Thanks