다음 코드에서 내가 시도한대로 strSide
"does not exist in the current context"
이름으로 표시된 것처럼 중단 점을 배치합니다. strSide
에 rawId
의 마지막 문자를 포함시키고 해당 문자를 제거하여 rawId
값이 정수로 변환되도록합니다. 컴파일러 오류가 발생하지 않지만 런타임 오류가 발생합니다.이름이 현재 컨텍스트에 존재하지 않습니다. - grrr
값이 rawId
일 때 8429R
일 때 스트립 핑이 작동하지만 st30에 대해 R
을 할당 할 수 없습니다.
foreach (string fieldName in Request.QueryString)
{
rawId = fieldName;
String strSide = Convert.ToString(rawId[rawId.Length - 1]); <-- name does not exist
if (!IsNumeric(rawId)) <--break point set here.
{
rawId = StripRightChar(rawId);
}
Qty = Request.QueryString[fieldName];
int productId = 0;
if (fieldName == "txtReference")
{
strComments = Request.QueryString[fieldName];
}
을하고 지난 무엇 문자 참조 그 끈? 또는'rawId'에 "watch 추가". 당신의 문장'String strSide = Convert.ToString (rawId [rawId.Length - 1]);'은 아무 것도하지 않습니다. 왜 그걸 가지고 있니? 추신! 마지막 문자를 length-1 문자열로 가져 오는 또 다른 방법은'strSide = rawId.Substring (rawId.Length - 1);'입니다. –