XName.ToString Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the expanded XML name in the format {namespace}localname
.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
Returns
A String that contains the expanded XML name in the format {namespace}localname
.
Examples
The following example calls WriteLine, passing an XName. This causes the ToString method to be called.
XNamespace ns = "http://www.adventure-works.com";
XElement root = new XElement(ns + "Root", "content");
Console.WriteLine(root.Name);
Console.WriteLine(root.Name.LocalName);
Console.WriteLine(root.Name.Namespace);
Imports <xmlns="http://www.adventure-works.com">
Module Module1
Sub Main()
Dim root As XElement = <Root>content</Root>
Console.WriteLine(root.Name)
Console.WriteLine(root.Name.LocalName)
Console.WriteLine(root.Name.Namespace)
End Sub
End Module
This example produces the following output:
{http://www.adventure-works.com}Root
Root
http://www.adventure-works.com
Applies to
See also
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET