DataMemberAttribute.Name Property

Definition

Gets or sets a data member name.

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
public string? Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

Property Value

The name of the data member. The default is the name of the target that the attribute is applied to.

Remarks

This property is used to override the default name of the data member that is derived from the name of the member annotated with the DataMemberAttribute.

The Name property enables you to use names that are not permitted as common language runtime (CLR) identifiers. In addition, this property enables the type author to define a data member name separate from the CLR member name. This separate definition helps in versioning scenarios (changing the CLR member name without breaking the data contract) and allows a different naming convention for data contact members and CLR members.

Applies to

See also