[Mono-list] Re: IConvertible and Enum
Andrei Zmievski
andrei@ispi.net
Mon, 14 Jan 2002 21:33:02 -0600
At 08:01 AM 1/14/02 -0500, Derek Holden wrote:
>In short, I don't care either way. I say uncomment the IConvertible
>declaration in the base types and have the methods just call the
>System.Convert methods. The only thing I ask is you take a look at the
>EMCA conversion chart and only allow those explicit conversions. Oh, and
>there's also a helper function defined in System.Convert for the ToType
>method. So in implementing 'object ToType (Type convesionType,
>IFormatProvider provider)' in the base types, you can just return
>Convert.ToType (value, conversionType, provider).
So, when using the System.Convert.To*() methods, the IFormatProvider
parameter to type's To*() method is ignored?
public struct Double : .... , IConvertible {
...
public bool ToBoolean (IFormatProvider provider)
{
return System.Convert.ToBoolean(value);
}
...
}
-Andrei