日期:2014-05-17 浏览次数:20953 次
public Form1() { InitializeComponent(); IList<TempNum> listTempNum = new List<TempNum>(); TempNum tempNum1 = new TempNum(); IList<string> listName1 = new List<string>(); listName1.Add("小明"); listName1.Add("小李"); tempNum1.Num1 = 16; tempNum1.Num2 = -7; tempNum1.Count = listName1.Count; TempNum tempNum2 = new TempNum(); IList<string> listName2 = new List<string>(); listName2.Add("小明"); listName2.Add("小李"); tempNum2.Num1 = 16; tempNum2.Num2 = -8; tempNum2.Count = listName2.Count; TempNum tempNum3 = new TempNum(); IList<string> listName3 = new List<string>(); listName3.Add("小明"); listName3.Add("小李"); tempNum3.Num1 = 17; tempNum3.Num2 = -7; tempNum3.Count = listName3.Count; TempNum tempNum4 = new TempNum(); IList<string> listName4 = new List<string>(); listName4.Add("小李"); tempNum4.Num1 = 17; tempNum4.Num2 = 1; tempNum4.Count = listName4.Count; TempNum tempNum5 = new TempNum(); IList<string> listName5 = new List<string>(); listName5.Add("小李"); tempNum5.Num1 = 17; tempNum5.Num2 = 2; tempNum5.Count = listName5.Count; TempNum tempNum6 = new TempNum(); IList<string> listName6 = new List<string>(); listName6.Add("小明"); listName6.Add("小李"); listName6.Add("小红"); tempNum6.Num1 = 15; tempNum6.Num2 = -10; tempNum6.Count = listName6.Count; TempNum tempNum7 = new TempNum(); IList<string> listName7 = new List<string>(); listName7.Add("小明"); listName7.Add("小李"); listName7.Add("小红"); tempNum7.Num1 = 15; tempNum7.Num2 = -9; tempNum7.Count = listName7.Count; TempNum tempNum8 = new TempNum(); IList<string> listName8 = new List<string>(); listName8.Add("小明"); tempNum8.Num1 = -10; tempNum8.Num2 = 18; tempNum8.Count = listName8.Count; TempNum tempNum9 = new TempNum(); IList<string> listName9 = new List<string>(); listName9.Add("小明"); tempNum9.Num1 = -9; tempNum9.Num2 = 18; tempNum9.Count = listName9.Count; listTempNum.Add(tempNum1); listTempNum.Add(tempNum2); listTempNum.Add(tempNum3); listTempNum.Add(tempNum4); listTempNum.Add(tempNum5); listTempNum.Add(tempNum6); listTempNum.Add(tempNum7); listTempNum.Add(tempNum8); listTempNum.Add(tempNum9); dataGridView1.DataSource = listTempNum; } public class TempNum { private int num1; public