本帖最后由 苟于伟 于 2013-4-15 02:35 编辑
- private void btnResult_Click(object sender, EventArgs e)
- {
- string[] lines = txt成绩.Lines;
- string maxName = "";
- int maxScore = -1;
- foreach (string line in lines)
- {
- string[] strs = line.Split('=');
- string name = strs[0];
- string strScore = strs[1];
- int score = Convert.ToInt32(strScore);
- if (score > maxScore)
- {
- maxName = name;
- maxScore = score;
- }
- }
- MessageBox.Show(string.Format("{0}的成绩{1}分",maxName,maxScore));
- }
复制代码 在使用 foreach中的foreach (string line in lines)时in所代表的含意,求解!!!!
|