I have enum:
public enum AlertSubject
{
TouristVisa = 1,
CarDamagene = 2,
RentalForceClose = 3,
CarAccident = 4
}
how to get key like a string? I mean "1"
for AlertSubject.TouristVisa
I have enum:
public enum AlertSubject
{
TouristVisa = 1,
CarDamagene = 2,
RentalForceClose = 3,
CarAccident = 4
}
how to get key like a string? I mean "1"
for AlertSubject.TouristVisa
You can use corresponding string format:
var s = AlertSubject.TouristVisa.ToString("d");
D or d. Displays the enumeration entry as an integer value in the shortest representation possible.