namespace _26枚举和结构使用 { //声明一个枚举类型 public enum Gender { 男, 女 } //声明一个结构类型 public struct Person { public string _name; public int _age; public Gender _gender; } class Program { static void Main(string[] args) { //定义一个结构类型Person,有三个成员,分别为姓名,性别,年龄 性别用枚举类型 //声明两个Person类型的变量,分别表示 张三 男 18岁/ 小雪 女 16岁 Person zsPerson; zsPerson._name = "张三"; zsPerson._age = 18; zsPerson._gender = Gender.男; //注意:枚举这里是用Gender点出男或女

        Person xxPerson;
        xxPerson._name = "小雪";
        xxPerson._age = 16;
        xxPerson._gender = Gender.女;

        Console.WriteLine("{0}今年{1}岁,性别{2}", zsPerson._name, zsPerson._age, zsPerson._gender);
        Console.WriteLine("{0}今年{1}岁,性别{2}", xxPerson._name, xxPerson._age, xxPerson._gender);

        Console.ReadKey();
    }
}

}