XName.Implicit(String to XName) 연산자

정의

중요

이 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

{namespace}localname 형식의 확장된 XML 이름이 들어 있는 문자열입니다.

반환

XName

확장된 이름을 사용하여 생성한 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>  

설명

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

적용 대상

추가 정보