XmlReader.AttributeCount 속성

정의

파생 클래스에서 재정의되는 경우 현재 노드의 특성 수를 가져옵니다.

public:
 abstract property int AttributeCount { int get(); };
public abstract int AttributeCount { get; }
member this.AttributeCount : int
Public MustOverride ReadOnly Property AttributeCount As Integer

속성 값

현재 노드의 특성 수입니다.

예외

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

설명

이 속성은 노드와 관련이 있으며 Element 노드에만 해당 DocumentTypeXmlDeclaration 합니다. (다른 노드 형식에는 특성이 없습니다.)

적용 대상