G
Guest
Hi,
I need a mechanism to verify programatically, if a particular datatype can
be/ can not be converted to another datatype with/without any loss of data.
i tried using TypeConverter.CanConvertFrom, but am getting incorrect values.
also i need the check to be done using strings containing the datatype names
eg., i need to know if any datatype of type "bool" can be converted to the
datatype "decimal", where i have the two strings stored in variables.
my failed attempt with TypeConverter.CanConvertFrom
TypeConverter x = TypeDescriptor.GetConverter( typeof( bool ));
bool b1 = x.CanConvertFrom( typeof( string ) );
bool b2 = x.CanConvertTo( typeof( string ) );
both b1 and b2 come out to be true !!!
Thanks in advance
regards
KumarForG
I need a mechanism to verify programatically, if a particular datatype can
be/ can not be converted to another datatype with/without any loss of data.
i tried using TypeConverter.CanConvertFrom, but am getting incorrect values.
also i need the check to be done using strings containing the datatype names
eg., i need to know if any datatype of type "bool" can be converted to the
datatype "decimal", where i have the two strings stored in variables.
my failed attempt with TypeConverter.CanConvertFrom
TypeConverter x = TypeDescriptor.GetConverter( typeof( bool ));
bool b1 = x.CanConvertFrom( typeof( string ) );
bool b2 = x.CanConvertTo( typeof( string ) );
both b1 and b2 come out to be true !!!
Thanks in advance
regards
KumarForG