XmlReader.Item[] 속성

정의

파생 클래스에서 재정의되면 특성의 값을 가져옵니다.

오버로드

Item[Int32]

파생 클래스에서 재정의되면 지정된 인덱스가 있는 특성의 값을 가져옵니다.

Item[String]

파생 클래스에서 재정의되면 지정된 Name이 있는 특성의 값을 가져옵니다.

Item[String, String]

파생 클래스에서 재정의되면 지정된 LocalNameNamespaceURI가 있는 특성의 값을 가져옵니다.

Item[Int32]

파생 클래스에서 재정의되면 지정된 인덱스가 있는 특성의 값을 가져옵니다.

public:
 virtual property System::String ^ default[int] { System::String ^ get(int i); };
public:
 abstract property System::String ^ default[int] { System::String ^ get(int i); };
public virtual string this[int i] { get; }
public abstract string this[int i] { get; }
member this.Item(int) : string
Default Public Overridable ReadOnly Property Item(i As Integer) As String
Default Public MustOverride ReadOnly Property Item(i As Integer) As String

매개 변수

i
Int32

특성의 인덱스입니다.

속성 값

String

지정된 특성의 값을 반환합니다.

예외

이전 비동기 작업이 완료되기 전에 XmlReader 메서드가 호출되었습니다. 이 경우 “비동기 작업이 이미 진행 중입니다.” 메시지를 나타내며 InvalidOperationException이 throw됩니다.

예제

다음 예제에서는 현재 노드의 모든 특성을 표시합니다.

// Display all attributes.
if (reader.HasAttributes) {
  Console.WriteLine("Attributes of <" + reader.Name + ">");
  for (int i = 0; i < reader.AttributeCount; i++) {
    Console.WriteLine("  {0}", reader[i]);
  }
  // Move the reader back to the element node.
  reader.MoveToElement();
}
' Display all attributes.
If reader.HasAttributes Then
  Console.WriteLine("Attributes of <" + reader.Name + ">")
  Dim i As Integer
  For i = 0 To (reader.AttributeCount - 1)
    Console.WriteLine("  {0}", reader(i))
  Next i
  ' Move the reader back to the element node.
  reader.MoveToElement() 
End If

설명

이 속성은 판독기를 이동하지 않습니다.

추가 정보

적용 대상

Item[String]

파생 클래스에서 재정의되면 지정된 Name이 있는 특성의 값을 가져옵니다.

public:
 virtual property System::String ^ default[System::String ^] { System::String ^ get(System::String ^ name); };
public:
 abstract property System::String ^ default[System::String ^] { System::String ^ get(System::String ^ name); };
public virtual string this[string name] { get; }
public virtual string? this[string name] { get; }
public abstract string this[string name] { get; }
member this.Item(string) : string
Default Public Overridable ReadOnly Property Item(name As String) As String
Default Public MustOverride ReadOnly Property Item(name As String) As String

매개 변수

name
String

특성의 정규화된 이름입니다.

속성 값

String

지정된 특성의 값을 반환합니다. 특성이 없으면 null이 반환됩니다.

예외

이전 비동기 작업이 완료되기 전에 XmlReader 메서드가 호출되었습니다. 이 경우 “비동기 작업이 이미 진행 중입니다.” 메시지를 나타내며 InvalidOperationException이 throw됩니다.

예제

다음 예제에서는 ISBN 특성의 값을 가져옵니다.

reader.ReadToDescendant("book");
string isbn =reader["ISBN"];
Console.WriteLine("The ISBN value: " + isbn);
reader.ReadToDescendant("book")
Dim isbn As String = reader("ISBN")
Console.WriteLine("The ISBN value: " + isbn)

설명

이 속성은 판독기를 이동하지 않습니다.

판독기를 노드에 배치하는 경우 이 메서드를 DocumentType 사용하여 PUBLIC 및 SYSTEM 리터럴을 가져올 수 있습니다. 예를 들면 다음과 같습니다. reader["PUBLIC"]

추가 정보

적용 대상

Item[String, String]

파생 클래스에서 재정의되면 지정된 LocalNameNamespaceURI가 있는 특성의 값을 가져옵니다.

public:
 virtual property System::String ^ default[System::String ^, System::String ^] { System::String ^ get(System::String ^ name, System::String ^ namespaceURI); };
public:
 abstract property System::String ^ default[System::String ^, System::String ^] { System::String ^ get(System::String ^ name, System::String ^ namespaceURI); };
public virtual string this[string name, string namespaceURI] { get; }
public virtual string? this[string name, string? namespaceURI] { get; }
public abstract string this[string name, string namespaceURI] { get; }
member this.Item(string * string) : string
Default Public Overridable ReadOnly Property Item(name As String, namespaceURI As String) As String
Default Public MustOverride ReadOnly Property Item(name As String, namespaceURI As String) As String

매개 변수

name
String

특성의 로컬 이름입니다.

namespaceURI
String

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

속성 값

String

지정된 특성의 값을 반환합니다. 특성이 없으면 null이 반환됩니다.

예외

이전 비동기 작업이 완료되기 전에 XmlReader 메서드가 호출되었습니다. 이 경우 “비동기 작업이 이미 진행 중입니다.” 메시지를 나타내며 InvalidOperationException이 throw됩니다.

설명

이 속성은 판독기를 이동하지 않습니다.

추가 정보

적용 대상