I have the following:
public static class CityStatusExt
{
public static string D2(this CityStatus key)
{
return ((int) key).ToString("D2");
}
public static class CityTypeExt
{
public static string D2(this CityType key)
{
return ((int) key).ToString("D2");
}
Plus other classes with similar extensions that return the key formatted as a "D2"
Is there a way I could inherit from a base class and have the base class provide the functionality so don't I don't have to repeat the same extension method code?
Update. I am sorry I did not mention this but my classes like CityType are Enums.