XmlAttributeAttribute.Namespace 속성

정의

XML 특성의 XML 네임스페이스를 가져오거나 설정합니다.

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

속성 값

XML 특성의 XML 네임스페이스입니다.

예제

다음 예제에서는 적용 합니다 XmlAttributeAttribute 클래스에 포함 된 두 개의 필드입니다. 이 예제에서는 각 특성의 Namespace 속성을 멤버 식별자와 다른 값으로 설정합니다.

public ref class Car
{
public:

   [XmlAttributeAttribute(Namespace="Make")]
   String^ MakerName;

   [XmlAttributeAttribute(Namespace="Model")]
   String^ ModelName;
};
public class Car
{
   [XmlAttribute(Namespace = "Make")]
   public string MakerName;

   [XmlAttribute(Namespace = "Model")]
   public string ModelName;
}
Public Class Car
    <XmlAttribute(Namespace := "Make")> _
    Public MakerName As String    

    <XmlAttribute(Namespace := "Model")> _
    Public ModelName As String
End Class

설명

속성은 Namespace 사양Namespaces in XMLhttp://www.w3.org 준수합니다.

접두사와 연결된 네임스페이스를 만들려면 XML 문서에 사용되는 네임스페이스 및 접두사를 포함하는 개체를 만들어야 XmlSerializerNamespaces 합니다. 각각 XmlAttributeAttribute 에 대해 설정한 네임스페이스는 개체의 네임스페이스 중 하나와 XmlSerializerNamespaces 일치해야 합니다. 는 XmlSerializer XML 코드를 생성할 때 각 특성 이름 앞에 올바르게 접두사를 지정합니다.

적용 대상