EnumMemberAttribute.Value Property

Gets or sets the value associated with the enumeration member the attribute is applied to.

Namespace:  System.Runtime.Serialization
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)

public string Value { get; set; }

Property Value

Type: System.String
The value associated with the enumeration member.

By default, the value of an enumeration is the name of the enumeration. When a value is specified, that value appears in the XML document or stream.

        // Define the data contract.
        [DataContract(Name = "Customer", Namespace = "http://www.contoso.com")]
        public class User
            [DataMember(Name = "Last", EmitDefaultValue = true, IsRequired = true, Order = 2)]
            public string Name { get; set; }

            [DataMember(Order = 1)]
            public int Age { get; set; }

            public Position Description;

            public User() { }

            public User(string newName, int newAge)
                Name = newName;
                Age = newAge;

        public enum Position
            [EnumMember(Value = "Emp")]

            [EnumMember(Value = "Mgr")]

            [EnumMember(Value = "Ctr")]



Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions