1. c# 结构:多种类型变量的集合
【语法:】
[public] struct 结构名称 { public int/string/char/... 变量名称1; public int/string/char/... 变量名称2; public int/string/char/... 变量名称3; } 例: public struct Person { public string name;
public int age;
public char sex; }
Person xiaoming;
xiaoming.name="小明";
xiaoming.age=18;
xiaoming.sex=‘男‘;
2. 枚举:多种常量的集合
【语法:】
public enum 枚举名称
{
常量1,
常量2,
常量3,
...
}
例:
public enum Color
{
Red,
Green,
Blue,
Yello,
Black
}
//调用办法
Color.Red / Color.Green / Color.Blue / ......