日期:2014-05-17 浏览次数:20866 次
/// <summary>
/// 定义一个结构,将编号和index关系起来
/// </summary>
struct NumberIndex
{
public int index;
public int number;
public NumberIndex(int index, int number)
{
this.index = index;
this.number = number;
}
}
static void Main(string[] args)
{
List<NumberIndex> list=new List<NumberIndex>();
NumberIndex numberIndex=new NumberIndex(0,15);
list.Add(numberIndex);
numberIndex=new NumberIndex(1,24);
list.Add(numberIndex);
numberIndex=new NumberIndex(2,3);
list.Add(numberIndex);
numberIndex=new NumberIndex(3,4);
list.Add(numberIndex);
numberIndex=new NumberIndex(4,5);
list.Add(numberIndex);
numberIndex=new NumberIndex(5,6);
list.Add(numberIndex);
numberIndex=new NumberIndex(6,7);
list.Add(numberIndex);
numberIndex=new NumberIndex(7,8);
list.Add(numberIndex);
Dictionary<NumberIndex,int> dic = new Dictionary<NumberIndex,int>();
dic.Add(list[0],48);
dic.Add(list[1],48);
&nb