就是我要传换成可以当做运算符的来用的。不是字符串的。怎么转化呀?
C#中可以有类似这样的操作,根据类型来执行你想要的运算:
if (obj.GetType() == typeof(int))
{
//
}
else if (obj.GetType() == typeof(double))
{
//
}
else if (obj.GetType() == typeof(IRichTextString))
{
//
}
else if (obj.GetType() == typeof(string))
{
//
}
else if (obj.GetType() == typeof(DateTime))
{
//
}
else if (obj.GetType() == typeof(bool))
{
//
}
else
{
//
}