2008-11-20 Jb Evain <jbevain@novell.com>
authorJb Evain <jbevain@gmail.com>
Thu, 20 Nov 2008 12:12:59 +0000 (12:12 -0000)
committerJb Evain <jbevain@gmail.com>
Thu, 20 Nov 2008 12:12:59 +0000 (12:12 -0000)
* TypeConverter_2_1.cs: update to SL2 api.

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

mcs/class/System/System.ComponentModel/ChangeLog
mcs/class/System/System.ComponentModel/TypeConverter_2_1.cs

index a910624f22ac8f10699014fd42cc4525bc1da86c..5338fca313d33e9dfb2c6769388e78cba4a95d8e 100644 (file)
@@ -1,3 +1,7 @@
+2008-11-20  Jb Evain  <jbevain@novell.com>
+
+       * TypeConverter_2_1.cs: update to SL2 api.
+
 2008-11-12  Jb Evain  <jbevain@novell.com>
 
        * IComponent.cs
index 015631f27e07e75897bfeaa15e633bd39ed8ff54..591f4ceb1fb7fdd9e0c559fb4c2b8caa05ad092d 100644 (file)
@@ -26,6 +26,7 @@
 #if NET_2_1
 
 using System;
+using System.Globalization;
 
 namespace System.ComponentModel {
 
@@ -33,28 +34,45 @@ namespace System.ComponentModel {
 
                public virtual bool CanConvertFrom (Type sourceType)
                {
-                       if (sourceType == null)
-                               return false;
+                       return CanConvertFrom (null, sourceType);
+               }
 
-                       return sourceType == typeof (string);
+               public virtual bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
+               {
+                       return false;
                }
 
                public virtual object ConvertFrom (object value)
                {
-                       return null;
+                       return ConvertFrom (null, CultureInfo.CurrentCulture, value);
+               }
+
+               public virtual object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+               {
+                       throw new NotImplementedException ();
                }
 
                public virtual object ConvertFromString (string text)
                {
-                       return ConvertFrom (text);
+                       return ConvertFrom (null, null, text);
                }
 
                public virtual bool CanConvertTo (Type destinationType)
+               {
+                       return CanConvertTo (null, destinationType);
+               }
+
+               public virtual bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
                {
                        return false;
                }
 
                public virtual object ConvertTo (object value, Type destinationType)
+               {
+                       return ConvertTo (null, CultureInfo.CurrentCulture, value, destinationType);
+               }
+
+               public virtual object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
                {
                        throw new NotImplementedException ();
                }