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
Tee yhteistyötä kanssamme GitHubissa
Tämän sisällön lähde on GitHubissa, jossa voit myös luoda ja tarkastella ongelmia ja pull-pyyntöjä. Katso lisätietoja osallistujan oppaasta.