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
小寫。
對不起,不提供完整的代碼... 假的也不是一成不變的......
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","")
怎麼樣'字符串RES1 = 「CalcAPI.GetXElementValue(」 + 「\」 「+ RES [0] + 」\「」 + 「」 +「\ 「」+ res [1] +「\」「+」,false)「'? –