summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml/XmlName.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Xaml/XmlName.cs')
-rw-r--r--Xamarin.Forms.Xaml/XmlName.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml/XmlName.cs b/Xamarin.Forms.Xaml/XmlName.cs
new file mode 100644
index 00000000..e22a162d
--- /dev/null
+++ b/Xamarin.Forms.Xaml/XmlName.cs
@@ -0,0 +1,58 @@
+using System.Diagnostics;
+
+namespace Xamarin.Forms.Xaml
+{
+ [DebuggerDisplay("{NamespaceURI}:{LocalName}")]
+ internal struct XmlName
+ {
+ public static readonly XmlName _CreateContent = new XmlName("_", "CreateContent");
+ public static readonly XmlName xKey = new XmlName("x", "Key");
+ public static readonly XmlName xName = new XmlName("x", "Name");
+ public static readonly XmlName xTypeArguments = new XmlName("x", "TypeArguments");
+ public static readonly XmlName xArguments = new XmlName("x", "Arguments");
+ public static readonly XmlName xFactoryMethod = new XmlName("x", "xFactoryMethod");
+
+ public string NamespaceURI { get; }
+
+ public string LocalName { get; }
+
+ public XmlName(string namespaceUri, string localName)
+ {
+ NamespaceURI = namespaceUri;
+ LocalName = localName;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj == null)
+ return false;
+ if (obj.GetType() != typeof (XmlName))
+ return false;
+ var other = (XmlName)obj;
+ return NamespaceURI == other.NamespaceURI && LocalName == other.LocalName;
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = 0;
+ if (NamespaceURI != null)
+ hashCode = NamespaceURI.GetHashCode();
+ if (LocalName != null)
+ hashCode = (hashCode * 397) ^ LocalName.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ public static bool operator ==(XmlName x1, XmlName x2)
+ {
+ return x1.NamespaceURI == x2.NamespaceURI && x1.LocalName == x2.LocalName;
+ }
+
+ public static bool operator !=(XmlName x1, XmlName x2)
+ {
+ return !(x1 == x2);
+ }
+ }
+} \ No newline at end of file