主要用于把字符串转换成为其他的类型。如:int,double等 public Object myParse(string v, Object defaultvalue)
{
Object ret = defaultvalue;
MethodInfo m = defaultvalue.GetType().GetMethod("Parse", new Type[] { typeof(string) });
try
{
if (m != null)
ret = m.Invoke(null, new Object[] { v });
else
ret = (Object)v;
}
catch (Exception){ }
return ret;
}
只是测试过少量的数据。没有作详细测试。所以不知道是否完整。请留意指点。谢谢。
只是测试过少量的数据。没有作详细测试。所以不知道是否完整。请留意指点。谢谢。