다음 코드는 서버에서 온 문자열에서 listitem을 생성해야합니다. 문자열 배열 "년"이있는 경우listitem에서 부정확 한 값
가foreach (String str in years)
{
if (string.IsNullOrEmpty(str) || str.Equals(" "))
{
System.Diagnostics.Debug.WriteLine("empty");
}
else
{
System.Diagnostics.Debug.WriteLine(str);
yearLi.Value = str;
yearList.Add(yearLi);
count = yearList.Count;
}
System.Diagnostics.Debug.WriteLine("count-->" + count);
}
이제 내 문제는, {2011,2012} 목록은 2011 년과 2012해야하지만 2012,2012를 가지고 다음과 같이 코드입니다. 이 코드에서 오류를 찾을 수 없습니다. 제발 조언.
'years '을 초기화하는 방법을 보여주세요. – egrunin