C#类说明 定义方式 class name {} 在一个类中可以定义变量,方法,数据结构等等,构成类的方法和变量称为类的成员。 一个类中调用另个类中的变量或者方法,则被调用的类中的变量和方法要定义为public
枚举类型 枚举类型不能定义在方法里。 enum days { //没有定义数值的时,默认从0开始数数。 Sun, Mon, tue, Wed, thu, Fri,Sat }
enum fruits { //可以自己重新定义编号 apple = 1, orange = 2, banana = 3 } void aab() { int a = Convert.ToInt16(fruits.apple); int ab = (int)fruits.orange; }