Enum to String
- TypeScript
Apple = <any>"Apple",
HTC = <any>"HTC",
Sony = <any>"Sony"
}
var text = MyPhone.Apple.toString();
- C#
{
[Display(Name = "Apple")]
Apple,
[Display(Name = "HTC")]
HTC,
[Display(Name = "Sony")]
Sony,
}
var text = MyPhone.Apple.ToEnumDisplayString();
Post a Comment: