XName.Equality(XName, XName) Operator
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 a value indicating whether two instances of XName are equal.
public:
static bool operator ==(System::Xml::Linq::XName ^ left, System::Xml::Linq::XName ^ right);
public static bool operator == (System.Xml.Linq.XName left, System.Xml.Linq.XName right);
public static bool operator == (System.Xml.Linq.XName? left, System.Xml.Linq.XName? right);
static member ( = ) : System.Xml.Linq.XName * System.Xml.Linq.XName -> bool
Public Shared Operator == (left As XName, right As XName) As Boolean
Parameters
Returns
true
if left
and right
are equal; otherwise false
.
Examples
The following example shows some comparisons between XName objects and strings.
XName xn;
xn = XName.Get("Root");
Console.WriteLine(xn == "Root");
xn = XName.Get("Root", "http://www.adventure-works.com");
Console.WriteLine(xn == "{http://www.adventure-works.com}Root");
XElement root = new XElement("Root", "content");
Console.WriteLine(root.Name == "Root");
Dim xn As XName
xn = XName.Get("Root")
Console.WriteLine(xn = "Root")
xn = XName.Get("Root", "http://www.adventure-works.com")
Console.WriteLine(xn = "{http://www.adventure-works.com}Root")
Dim root As XElement = New XElement("Root", "content")
Console.WriteLine(root.Name = "Root")
This example produces the following output:
True
True
True
Remarks
The operator overloads ==
and !=
are included to enable comparisons between XName and a string
, such aselement.Name == "SomeElementName"
. The predefined reference equality operators in C# require one operand to be convertible to the type of the other through reference conversions only. These operators do not consider the implicit conversion from string to XName.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기