XNamespace.Get(String) Metodo

Definizione

Ottiene un oggetto XNamespace per l'URI (Uniform Resource Identifier) specificato.

public:
 static System::Xml::Linq::XNamespace ^ Get(System::String ^ namespaceName);
public static System.Xml.Linq.XNamespace Get(string namespaceName);
static member Get : string -> System.Xml.Linq.XNamespace
Public Shared Function Get (namespaceName As String) As XNamespace

Parametri

namespaceName
String

Oggetto String contenente un URI dello spazio dei nomi.

Valori restituiti

Oggetto XNamespace creato dall'URI specificato.

Esempio

Nell'esempio seguente viene ottenuto un XNamespace oggetto da un URI specificato.

XNamespace aw = XNamespace.Get("http://www.adventure-works.com");

// This is the preferred form.
XNamespace aw2 = "http://www.adventure-works.com";
Console.WriteLine(aw);
Console.WriteLine(aw2);
Imports <xmlns:aw="http://www.adventure-works.com">

Module Module1
    Sub Main()
        Dim aw As XNamespace = XNamespace.Get("http://www.adventure-works.com")

        ' This is the preferred form.
        Dim aw2 As XNamespace = GetXmlNamespace(aw)
        Console.WriteLine(aw)
        Console.WriteLine(aw2)
    End Sub
End Module

In questo esempio viene generato l'output seguente:

http://www.adventure-works.com
http://www.adventure-works.com

Commenti

L'oggetto restituito è garantito che sia atomico XNamespace , ovvero è l'unico nel sistema per quel particolare URI.

Si applica a

Vedi anche