XName.Implicit(String to XName) 연산자

정의

Important

이 API는 CLS 규격이 아닙니다.

확장된 XML 이름(즉,{namespace}localname)으로 서식이 지정된 문자열을 개체로 XName 변환합니다.

public:
 static operator System::Xml::Linq::XName ^(System::String ^ expandedName);
[System.CLSCompliant(false)]
public static implicit operator System.Xml.Linq.XName(string expandedName);
[System.CLSCompliant(false)]
public static implicit operator System.Xml.Linq.XName?(string? expandedName);
[<System.CLSCompliant(false)>]
static member op_Implicit : string -> System.Xml.Linq.XName
Public Shared Widening Operator CType (expandedName As String) As XName

매개 변수

expandedName
String

확장된 XML 이름을 형식 {namespace}localname으로 포함하는 문자열입니다.

반품

XName 확장된 이름에서 생성된 개체입니다.

특성

예제

다음 예제에서는 이 암시적 변환 연산자를 호출하는 문자열을 할당하여 만듭니다 XName .

XElement el = new XElement("{http://www.adventure-works.com}Root", "content");
Console.WriteLine(el);

// The preferred approach is to initialize an XNamespace object
// and use the overload of the addition operator.
XNamespace aw = "http://www.adventure-works.com";
XElement root = new XElement(aw + "Root", "content");
Console.WriteLine(root);
Imports <xmlns="http://www.adventure-works.com">

Module Module1
    Sub Main()
        Dim el As XElement = New XElement("{http://www.adventure-works.com}Root", "content")
        Console.WriteLine(el)

        ' The preferred approach is to import a global namespace and
        ' use an XML literal.
        Dim root As XElement = <Root>content</Root>
        Console.WriteLine(root)
    End Sub
End Module

이 예제는 다음과 같은 출력을 생성합니다.

<Root xmlns="http://www.adventure-works.com">content</Root>
<Root xmlns="http://www.adventure-works.com">content</Root>

설명

이 암시적 연산자는 만들 XElement 거나 XAttribute 적절한 생성자에 문자열을 전달하여 사용합니다.

적용 대상

추가 정보