Update of /cvsroot/nullabletypes/NullableTypes/src/Types
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27004/src/Types
Modified Files:
NullableGuid.cs
Log Message:
Prevent NullableGuid.Equals throwing an exception and add a suitable test case.
Bug:1265822
Index: NullableGuid.cs
===================================================================
RCS file: /cvsroot/nullabletypes/NullableTypes/src/Types/NullableGuid.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** NullableGuid.cs 12 Feb 2005 03:44:34 -0000 1.4
--- NullableGuid.cs 23 Sep 2005 09:31:50 -0000 1.5
***************
*** 9,12 ****
--- 9,15 ----
// 28-Jan-2005 DamienG Completed Removed NullableBinary code, fixed ToNullableString, added missing constructor,
// Added IXmlSerializable support
+ // 05-Sep-2005 DamienG Bugfix Fix for #265822 - NullableGuid Equals method throws NullableNullValueException
+ // from patrickvd
+ // 05-Sep-2005 DamienG Upgrade Added new Empty handling as per NullableString.
//
***************
*** 24,27 ****
--- 27,32 ----
public static readonly NullableGuid Null;
+ public static readonly NullableGuid Empty = new NullableGuid(System.Guid.Empty);
+
#endregion // Fields
***************
*** 80,83 ****
--- 85,90 ----
else if (this.IsNull && ((NullableGuid)value).IsNull)
return true;
+ else if (this.IsNull)
+ return false;
else if (((NullableGuid)value).IsNull)
return false;
***************
*** 105,109 ****
public override int GetHashCode() {
! return _value.GetHashCode();
}
#endregion // Equivalence
--- 112,118 ----
public override int GetHashCode() {
! System.Guid tmp = (IsNull) ? System.Guid.Empty : _value;
!
! return tmp.GetHashCode();
}
#endregion // Equivalence
|