Editare

Partajați prin


DataContractAttribute.Namespace Property

Definition

Gets or sets the namespace for the data contract for the type.

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

Property Value

The namespace of the contract.

Remarks

Use this property to specify a particular namespace if your type must return data that complies with a specific data contract.

Tip

For the data to be successfully transmitted, the name of the data in a data contract must be the same in both the client and the server. Visual Basic projects, by default, add a prefix to the namespace defined in each file (called the "root namespace," named after the project). Adding this prefix causes the client and server namespaces to be different for the same type. The solution is to set the Namespace property to "", or to explicitly set the data contract namespace in this property.

Applies to