Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAjay kumar Dwivedi <ajay@mono-cvs.ximian.com>2002-06-21 16:58:58 +0400
committerAjay kumar Dwivedi <ajay@mono-cvs.ximian.com>2002-06-21 16:58:58 +0400
commit21689da521c38928b6cd1db9d595982cab2ad8d1 (patch)
treedc97547453d7c1fa047f502bf627025d3f3a0a05 /mcs/class/System.XML/System.Xml
parentf4d6e1c0348bda42cd3ab22cd8b3940a0a63cc52 (diff)
2002-06-21 Ajay kumar Dwivedi <adwiv@yahoo.com>
* XmlQualifiedName: Name and Namespaces are never null. If null is passed to the constructor, set them to empty strings. Fixed the Operators. svn path=/trunk/mcs/; revision=5392
Diffstat (limited to 'mcs/class/System.XML/System.Xml')
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog6
-rw-r--r--mcs/class/System.XML/System.Xml/XmlQualifiedName.cs28
2 files changed, 25 insertions, 9 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index ca8120a4623..c4a90709c57 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-21 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlQualifiedName: Name and Namespaces are never null. If null is passed
+ to the constructor, set them to empty strings.
+ Fixed the Operators.
+
2002-06-18 Ajay kumar Dwivedi <adwiv@yahoo.com>
* XmlTextReader.cs: HasLineInfo returns false instead of throwing an
diff --git a/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
index 8e559a749ba..c7c8197ff7f 100644
--- a/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
+++ b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
@@ -2,9 +2,11 @@
// System.Xml.XmlQualifiedName.cs
//
// Author: Duncan Mak (duncan@ximian.com)
-//
+//
// (C) Ximian, Inc.
-//
+//
+// Modified:
+// 21st June 2002 : Ajay kumar Dwivedi (adwiv@yahoo.com)
using System;
@@ -14,14 +16,13 @@ namespace System.Xml
{
// Constructors
public XmlQualifiedName ()
- : base ()
+ : this (string.Empty, string.Empty)
{
}
public XmlQualifiedName (string name)
- : base ()
+ : this (name, string.Empty)
{
- this.name = name;
}
public XmlQualifiedName (string name, string ns)
@@ -60,13 +61,19 @@ namespace System.Xml
// Methods
public override bool Equals (object other)
{
+ if(!(other is XmlQualifiedName))
+ return false;
+
if ((XmlQualifiedName) this == (XmlQualifiedName) other)
return true;
else
return false;
}
- [MonoTODO] public override int GetHashCode () { return 42; }
+ public override int GetHashCode ()
+ {
+ return unchecked (name.GetHashCode() + ns.GetHashCode());
+ }
public override string ToString ()
{
@@ -78,7 +85,7 @@ namespace System.Xml
public static string ToString (string name, string ns)
{
- if (ns == null)
+ if (ns == string.Empty)
return name;
else
return ns + ":" + name;
@@ -87,6 +94,9 @@ namespace System.Xml
// Operators
public static bool operator == (XmlQualifiedName a, XmlQualifiedName b)
{
+ if((Object)a == null || (Object)b == null)
+ return false;
+
if ((a.Name == b.Name) && (a.Namespace == b.Namespace))
return true;
else
@@ -95,10 +105,10 @@ namespace System.Xml
public static bool operator != (XmlQualifiedName a, XmlQualifiedName b)
{
- if (!(a == b))
+ if (a == b)
return false;
else
return true;
}
}
-}
+} \ No newline at end of file