Exposing the DescriptionAttribute of Enums from a WCF Service

后端 未结 3 933
予麋鹿
予麋鹿 2021-01-22 11:58

how can i expose description attribute in enum values from service to client or web reference using WCF or

how can i expose enum with description attribute to client

3条回答
  •  心在旅途
    2021-01-22 12:59

    Check out the XmlEnum Attribute. That will allow you to specify the "Name" of the xml attribute. Eg:

    public enum MyEnum
    {
        [XmlEnum("Coolbox")]
        Esky,
        [XmlEnum("Sandles")]
        Thong,
        [XmlEnum("MoreLikeGridironThanRealFootball")]
        Footy,
    }
    

提交回复
热议问题