XElement.HasAttributes 속성

정의

이 요소에 특성이 하나 이상 있는지를 나타내는 값을 가져옵니다.

public:
 property bool HasAttributes { bool get(); };
public bool HasAttributes { get; }
member this.HasAttributes : bool
Public ReadOnly Property HasAttributes As Boolean

속성 값

Boolean

이 요소에 특성이 최소한 하나 있으면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는이 속성을 사용 합니다.

XElement xmlTree1 = new XElement("Root",  
    new XAttribute("Att1", 1)  
);  
Console.WriteLine(xmlTree1.HasAttributes);  
XElement xmlTree2 = new XElement("Root");  
Console.WriteLine(xmlTree2.HasAttributes);  
Dim xmlTree1 As XElement = <Root Att1="1"/>  
Console.WriteLine(xmlTree1.HasAttributes)  

Dim xmlTree2 As XElement = <Root/>  
Console.WriteLine(xmlTree2.HasAttributes)  

이 예제는 다음과 같은 출력을 생성합니다.

True  
False  

적용 대상

추가 정보