未能找到类型或命名空间名称“Student”(是否缺少 using 指令或程序集引用?
using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ch05.Examples
{
class SortedDictionaryExample
{
StringBuilder sb = new StringBuilder();
public SortedDictionaryExample()
{
SortedDictionary<int, Student> students = new SortedDictionary<int, Student>()
{
{2,new Student {Name="李四",Gender="男"}},
{1,new Student {Name="张三",Gender="男"}},
{3,new Student {Name="王五",Gender="男"}}
};
foreach(var v in students)
{
sb.AppendLine(string.Format("编号:{0}--姓名:{1},性别:{2}",v.Key,v.Value.Name,v.Value.Gender));
}
}
public string GetOutPut()
{
return sb.ToString();
}
}
}