XmlReader.HasAttributes 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
현재 노드에 특성이 있는지 여부를 나타내는 값을 가져옵니다.
public:
virtual property bool HasAttributes { bool get(); };
public virtual bool HasAttributes { get; }
member this.HasAttributes : bool
Public Overridable ReadOnly Property HasAttributes As Boolean
속성 값
true현재 노드에 특성이 있으면 이고, 그렇지 않으면 . false
예외
XmlReader 이전 비동기 작업이 완료되기 전에 메서드가 호출되었습니다. 이 경우 InvalidOperationException "비동기 작업이 이미 진행 중입니다."라는 메시지와 함께 throw됩니다.
예제
다음은 현재 노드의 모든 특성을 표시하는 예제입니다.
if (reader.HasAttributes) {
Console.WriteLine("Attributes of <" + reader.Name + ">");
while (reader.MoveToNextAttribute()) {
Console.WriteLine(" {0}={1}", reader.Name, reader.Value);
}
// Move the reader back to the element node.
reader.MoveToElement();
}
If reader.HasAttributes Then
Console.WriteLine("Attributes of <" + reader.Name + ">")
While reader.MoveToNextAttribute()
Console.WriteLine(" {0}={1}", reader.Name, reader.Value)
End While
' Move the reader back to the element node.
reader.MoveToElement()
End If