[redland-dev] C# cleanup

Edd Dumbill edd at usefulinc.com
Wed Jul 14 16:37:55 BST 2004


On Wed, 2004-07-14 at 16:04 +0100, Dave Beckett wrote:
> 
> Unhandled Exception: System.NullReferenceException: Object reference
> not set to an instance of an object
> in <0x0000b> Redland.Node:op_Equality (Redland.Node,Redland.Node)
> in <0x00018> Test:Main ()

Aha, this in particular is a bug in Node.cs.  Uri doesn't have this
problem, afaics, as it has no == overloading (it probably should!)

Try these implementations for Node and see if they help:

		public static bool operator == (Node n1, Node n2)
		{
			if (Object.Equals (n1, null))
				if (Object.Equals (n2, null))
					return true;
				else
					return false;

			return n1.Equals (n2);
		}

		public static bool operator != (Node n1, Node n2)
		{
			if (Object.Equals (n1, null))
				if (Object.Equals (n2, null))
					return false;
				else
					return true;

			return !n1.Equals (n2);
		}






More information about the redland-dev mailing list