XNode.ToString 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
필요에 따라 서식을 사용하지 않도록 설정하여 이 노드에 대한 XML을 반환합니다.
오버로드
| Name | Description |
|---|---|
| ToString() |
이 노드에 대해 들여쓰기된 XML을 반환합니다. |
| ToString(SaveOptions) |
필요에 따라 서식을 사용하지 않도록 설정하여 이 노드에 대한 XML을 반환합니다. |
ToString()
- Source:
- XNode.cs
- Source:
- XNode.cs
- Source:
- XNode.cs
- Source:
- XNode.cs
- Source:
- XNode.cs
이 노드에 대해 들여쓰기된 XML을 반환합니다.
public:
override System::String ^ ToString();
public override string ToString();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
반품
String 들여쓰기된 XML을 포함하는 항목입니다.
예제
다음 예제에서는 이 메서드를 사용하여 들여쓰기된 XML을 검색합니다.
XElement xmlTree = new XElement("Root",
new XElement("Child1", 1)
);
Console.WriteLine(xmlTree);
Dim xmlTree As XElement = _
<Root>
<Child1>1</Child1>
</Root>
Console.WriteLine(xmlTree)
이 예제는 다음과 같은 출력을 생성합니다.
<Root>
<Child1>1</Child1>
</Root>
추가 정보
적용 대상
ToString(SaveOptions)
- Source:
- XNode.cs
- Source:
- XNode.cs
- Source:
- XNode.cs
- Source:
- XNode.cs
- Source:
- XNode.cs
필요에 따라 서식을 사용하지 않도록 설정하여 이 노드에 대한 XML을 반환합니다.
public:
System::String ^ ToString(System::Xml::Linq::SaveOptions options);
public string ToString(System.Xml.Linq.SaveOptions options);
override this.ToString : System.Xml.Linq.SaveOptions -> string
Public Function ToString (options As SaveOptions) As String
매개 변수
- options
- SaveOptions
서식 동작을 지정하는 A SaveOptions 입니다.
반품
String XML을 포함하는 A입니다.
예제
다음 예제에서는 이 메서드를 사용하여 서식이 지정되지 않은 XML을 검색합니다.
XElement root = XElement.Parse("<Root><Child/></Root>");
Console.WriteLine(root.ToString(SaveOptions.DisableFormatting));
Console.WriteLine("---");
Console.WriteLine(root.ToString(SaveOptions.None));
Dim root As XElement = <Root>
<Child/>
</Root>
Console.WriteLine(root.ToString(SaveOptions.DisableFormatting))
Console.WriteLine("---")
Console.WriteLine(root.ToString(SaveOptions.None))
이 예제는 다음과 같은 출력을 생성합니다.
<Root><Child /></Root>
---
<Root>
<Child />
</Root>