2012-08-27 3 views
0
string res1 = "CalcAPI.GetXElementValue(" + "\"" + res[0] + "\"" + "," + "\"" + res[1] + "\"" + "," + 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) 

입니다하지만 난 후 결과 문자열을

string res1 = "CalcAPI.GetXElementValue(" + "\"" + res[0] + "\"" + "," + "\"" + res[1] + "\"" + "," + GetElementDataType("string") + ")" 

를 전달하면 내가

CalcAPI.GetXElementValue("IRS5555","IRS001",0.0) 

CalcAPI.GetXElementValue("IRS5555","IRS001",) 
,536,913되고 싶어 63,210

는하지만 난

CalcAPI.GetXElementValue("IRS5555","IRS001","") 
+1

방법'에 대해 : 그리고 문자열 형식으로 사용하는 것이 좋습니다 그것은' "+ res [1] +"\ ""+ ", false)"'? –

답변

0

사용 ToLower는() 함수이

string res1 = "CalcAPI.GetXElementValue(" + "\"" + res[0] + "\"" + "," + "\"" + res[1] + "\"" + "," + false.ToString().ToLower() + ")" 
1

사용 false.ToString().ToLower() 같이합니다. 당신의 거짓이 일정한 경우

+0

Jensen ToString의 끝에 대괄호()를 추가합니다. –

+0

죄송합니다. – Jensen

+0

나는 젠슨을 이해합니다. –

0

그런 다음 간단한 문자열을 사용할 수

false.ToString().ToLower() 
5

으로 시도합니다. 문자열 RES1 = "CalcAPI.GetXElementValue ("+ "\" "+ 고해상도 [0] +"\ ""+ ","+ "\

string res1 = string.Format("CalcAPI.GetXElementValue(\"{0}\",\"{1}\",false)", res[0], res[1]);