string res1 = "CalcAPI.GetXElementValue(" + "\"" + res[0] + "\"" + "," + "\"" + res[1] + "\"" + "," + false + ")"
在
res[0] = "IRS5555"
res[1] = "IRS001"
这段代码的输出是:
CalcAPI.GetXElementValue("IRS5555","IRS001",False)
但我想要
CalcAPI.GetXElementValue("IRS5555","IRS001",false)
false
小写。
抱歉没有提供完整的代码... false 不是静态的...
public static object GetElementDataType(string DataType)
{
///Write here methos for fetching data type of current element.
object res = null;
switch (DataType.ToLower())
{
case "int":
res = 0;
break;
case "double":
res = 0.0;
break;
case "string":
res = "";
break;
case "myboolean":
res = false;
break;
default:
res = "";
break;
}
return res;
}
string res1 =
"CalcAPI.GetXElementValue(" + "\"" + res[0] + "\"" + ","
+ "\"" + res[1] + "\"" + ","
+ GetElementDataType("myboolean") + ")"
那么结果是
CalcAPI.GetXElementValue("IRS5555","IRS001",False)
但我想要
CalcAPI.GetXElementValue("IRS5555","IRS001",false)
如果我通过双倍
string res1 = "CalcAPI.GetXElementValue(" + "\"" + res[0] + "\"" + "," + "\"" + res[1] + "\"" + "," + GetElementDataType("double") + ")"
那么结果是
CalcAPI.GetXElementValue("IRS5555","IRS001",0)
但我想要
CalcAPI.GetXElementValue("IRS5555","IRS001",0.0)
如果我通过字符串
string res1 = "CalcAPI.GetXElementValue(" + "\"" + res[0] + "\"" + "," + "\"" + res[1] + "\"" + "," + GetElementDataType("string") + ")"
那么结果是
CalcAPI.GetXElementValue("IRS5555","IRS001",)
但我想要
CalcAPI.GetXElementValue("IRS5555","IRS001","")