Ler en inglés Editar

Compartir por


DataMemberAttribute.Name Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets or sets a data member name.

C#
public string Name { get; set; }
C#
public string? Name { get; set; }

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

Produto Versións
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

See also