Merge pull request #656 from LogosBible/collection_lock
[mono.git] / mcs / class / corlib / System / DBNull.cs
index 8025df370ce62b7ad5343fc154d0222c06a60ea3..e730cc8599dbc17c8eca068f516552de363f12a6 100644 (file)
 //
 
 using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
 
 namespace System
 {
        [Serializable]
+       [ComVisible (true)]
        public sealed class DBNull : ISerializable, IConvertible
        {
                // Fields
@@ -118,10 +120,12 @@ namespace System
                        throw new InvalidCastException ();
                }
 
-               object IConvertible.ToType (Type type, IFormatProvider provider)
+               object IConvertible.ToType (Type targetType, IFormatProvider provider)
                {
-                       if (type == typeof (string))
+                       if (targetType == typeof (string))
                                return String.Empty;
+                       if (targetType == typeof (DBNull))
+                               return this;
                        throw new InvalidCastException ();
                }