XNamespace.Get(String) Yöntem

Tanım

Belirtilen Tekdüzen Kaynak Tanımlayıcısı (URI) için bir XNamespace alır.

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

Parametreler

namespaceName
String

Ad String alanı URI'si içeren bir.

Döndürülenler

XNamespace Belirtilen URI'den oluşturulan.

Örnekler

Aşağıdaki örnek, belirtilen bir URI'den bir XNamespace alır.

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

Bu örnek aşağıdaki çıkışı oluşturur:

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

Açıklamalar

Döndürülen XNamespace nesnenin atomik olması garanti edilir (yani, sistemde söz konusu URI için tek nesnedir).

Şunlara uygulanır

Ayrıca bkz.