* TypeDescriptor.cs: Added support for NullableConverter.
* TypeDescriptorTests.cs: Added a test for the NullableConverter support.
svn path=/trunk/mcs/; revision=120946
+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.
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)
+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.
#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]