Student s = new Student();
List<Student> list = new List<Student>();
s.Height = "19";
s.Weight = "100KG";
s.Gender = "男";
list.Add(s);
//List<int> list = new List<int>();
//list.Add(1);
//list.Add(2);
for (int i = 0; i <list.Count; i++)
{
Console.WriteLine(list[i].Gender); //注意此处如果想遍历集合中的元素需要使用集合对象.属性
}
Console.ReadKey();
枚举:
public enum Job
{
sit=7,
speak=30,
}
如果枚举中需要较大的数字类型的话使用符号“:” (默认数字类型为int)
public enum Job:Long
{
sit=7,
speak=300000000000025,
}