XmlTypeAttribute 클래스

정의

XmlSerializer가 특성 대상을 serialize할 때 생성되는 XML 스키마를 제어합니다.

public ref class XmlTypeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct)]
public class XmlTypeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct)>]
type XmlTypeAttribute = class
    inherit Attribute
Public Class XmlTypeAttribute
Inherits Attribute
상속
XmlTypeAttribute
특성

예제

다음 예제에서는 적용된 두 개의 클래스를 XmlTypeAttribute 보여 줍니다.


[XmlType(Namespace="http://www.cpandl.com",
TypeName="GroupMember")]
public ref class Person
{
public:
   String^ Name;
};


[XmlType(Namespace="http://www.cohowinery.com",
TypeName="GroupAddress")]
public ref class Address
{
public:
   String^ Line1;
   String^ Line2;
   String^ City;
   String^ State;
   String^ Zip;
};

public ref class Group
{
public:
   array<Person^>^Staff;
   Person^ Manager;
   Address^ Location;
};
[XmlType(Namespace = "http://www.cpandl.com",
TypeName = "GroupMember")]
public class Person
{
   public string Name;
}

[XmlType(Namespace = "http://www.cohowinery.com",
TypeName = "GroupAddress")]
public class Address
{
   public string Line1;
   public string Line2;
   public string City;
   public string State;
   public string Zip;
}

public class Group
{
   public Person[] Staff;
   public Person Manager;
   public Address Location;
}
<XmlType(Namespace := "http://www.cpandl.com", _
 TypeName := "GroupMember")> _
Public Class Person
    Public Name As String
End Class

<XmlType(Namespace := "http://www.cohowinery.com", _
 TypeName := "GroupAddress")> _ 
Public Class Address
    
    Public Line1 As String
    Public Line2 As String
    Public City As String
    Public State As String
    Public Zip As String
End Class

Public Class Group
    Public Staff() As Person
    Public Manager As Person
    Public Location As Address
End Class

설명

개체 XmlTypeAttribute 를 직렬화하거나 역직렬화하는 방법을 XmlSerializer 제어하는 특성 패밀리에 속합니다. 유사한 특성의 전체 목록은 XML Serialization을 제어하는 특성을 참조하세요.

클래스, 구조체, 열거형 또는 인터페이스 선언에 적용 XmlTypeAttribute 할 수 있습니다.

클래스에 XmlTypeAttribute 적용하여 XML 형식의 네임스페이스, XML 형식 이름 및 XML 스키마 문서에 형식을 포함할지 여부를 지정합니다. 속성을 설정 하는 결과를 확인 합니다 XmlTypeAttribute 클래스, 실행 파일 또는 DLL로 애플리케이션을 컴파일 및 결과 파일을 전달 합니다 XML 스키마 정의 도구 (Xsd.exe). 도구는 형식 정의를 포함하여 스키마를 작성합니다.

참고

속성을 false설정 IncludeInSchema 하면 xml 스키마 정의 도구(Xsd.exe)에 스키마에 형식이 포함되지 않습니다. 기본적으로 각 공용 클래스에 대해 XSD 도구는 해당 형식의 요소와 a complexType 를 생성합니다.

특성을 사용 하는 방법에 대 한 자세한 내용은 참조 하세요. 특성합니다.

참고

더 긴 XmlTypeAttribute대신 코드에서 단어를 XmlType 사용할 수 있습니다.

생성자

XmlTypeAttribute()

XmlTypeAttribute 클래스의 새 인스턴스를 초기화합니다.

XmlTypeAttribute(String)

XmlTypeAttribute 클래스의 새 인스턴스를 초기화하고 XML 형식의 이름을 지정합니다.

속성

AnonymousType

결과 스키마 형식이 XSD 익명 형식인지 여부를 결정하는 값을 가져오거나 설정합니다.

IncludeInSchema

XML 스키마 문서에 형식을 포함할지 여부를 나타내는 값을 가져오거나 설정합니다.

Namespace

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

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)
TypeName

XML 형식의 이름을 가져오거나 설정합니다.

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상

추가 정보