enum Gender
{
男,
女,
}
public struct Person
{
public string name;
public Gender sex;
public int age;
}
class Program
{
static void Main(string[] args)
{
Person onePerson, secPerson;
onePerson.name = "张三";
onePerson.sex = Gender.男;
onePerson.age = 20;
Console.WriteLine("我叫{0},性别{1},今年{2}岁了",onePerson.name,onePerson.sex,onePerson.age);
secPerson.name = "小兰";
secPerson.sex = Gender.女;
secPerson.age = 26;
Console.WriteLine("我叫{0},性别{1},今年{2}岁了", secPerson.name, secPerson.sex,secPerson.age);
Console.ReadKey(); |