2008-12-06 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Sat, 6 Dec 2008 16:35:57 +0000 (16:35 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Sat, 6 Dec 2008 16:35:57 +0000 (16:35 -0000)
* TypeDescriptor.cs: Added support for NullableConverter.
* TypeDescriptorTests.cs: Added a test for the NullableConverter support.

svn path=/trunk/mcs/; revision=120946

mcs/class/System/System.ComponentModel/ChangeLog
mcs/class/System/System.ComponentModel/TypeDescriptor.cs
mcs/class/System/Test/System.ComponentModel/ChangeLog
mcs/class/System/Test/System.ComponentModel/TypeDescriptorTests.cs

index 8ccd9c241dd744d4e28d761c16a69bb2dd1554b5..8317e69261d9a30671ed0b71fccbf7c130d64ff3 100644 (file)
@@ -1,3 +1,7 @@
+2008-12-06  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * TypeDescriptor.cs: Added support for NullableConverter.
+
 2008-12-06  Ivan N. Zlatev  <contact@i-nz.net>
 
        * NullableConverter.cs: Implemented.
index 29db95a92ae11fc3f74ffab8d9e288333bccd13a..82cfc073acf54fc3b5ce805ed6b39746d34d58d4 100644 (file)
@@ -377,7 +377,10 @@ public sealed class TypeDescriptor
        private static Type FindDefaultConverterType (Type type)
        {
                Type converterType = null;
-
+#if NET_2_0
+               if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
+                       return typeof(NullableConverter);
+#endif
                // Is there a default converter
                foreach (DictionaryEntry entry in DefaultConverters) {
                        if ((Type)entry.Key == type)
index 0ccce1ae95198fdbae8cc498b559530c459d9a48..ba6076387e9d0690bb97a8e493aec8fbbf60eb1f 100644 (file)
@@ -1,3 +1,7 @@
+2008-12-06  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * TypeDescriptorTests.cs: Added a test for the NullableConverter support.
+
 2008-12-06  Ivan N. Zlatev  <contact@i-nz.net>
 
        * NullableConverterTest.cs: Added.
index b4b9e88c3e9832857ea095f00a4d33a38388c6d9..a795006eb2d3edc1bfcec6e815461f393765da24 100644 (file)
@@ -655,6 +655,10 @@ namespace MonoTests.System.ComponentModel
 #endif
                        Assert.IsTrue (TypeDescriptor.GetConverter (typeof (Component)) is ComponentConverter, "#29");
                        Assert.IsTrue (TypeDescriptor.GetConverter (new Component()) is ComponentConverter, "#30");
+
+#if NET_2_0
+                       Assert.AreEqual (typeof (NullableConverter), TypeDescriptor.GetConverter (typeof (int?)).GetType (), "#31");
+#endif
                }
                
                [Test]