2016年10月6日 星期四

  • TypeScript
export enum MyPhone {
    Apple = <any>"Apple",
    HTC = <any>"HTC",
    Sony = <any>"Sony"
}
var text = MyPhone.Apple.toString();

  • C#
public enum MyPhone
{
    [Display(Name = "Apple")]
    Apple,
    [Display(Name = "HTC")]
    HTC,
    [Display(Name = "Sony")]
    Sony,
}
var text = MyPhone.Apple.ToEnumDisplayString();

Post a Comment: