1.结构 struct
所有的值类型都是一个结构,所有的引用类型都是一个Class 类 (结构是值类型,而类是引用类型)
struct 类型是一种值类型 自定义类型 通常用封装小型相关变量组。
由于结构不使用引用,因此结构没有标识;无法区分具有相同数据的两个类型实例。
与类不同,结构的实例化可以不适用new运算符
结构的实例化有两种方式:
            struct MyStr
            {
                public int i;
            }            
            MyStr ms1 = new MyStr();
           MyStr ms2;
           ms2.i=10;
struct Goods   //相当于模板
    {
        public void Print()
        {
            Console.WriteLine(Name + Price + Count);
        }
        public Goods(string name)   //有参的构造函数
        {
            this.name = "bbb";
            this.price = 1.5;
            this.count = 5;
        }
        string name;
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }
        double price;
        public double Price
        {
            get
            {
                return price;
            }
            set
            {
                price = value;
            }
        }
        int count;
        public int Count
        {
            get
            {
                return count;
            }
            set
            {
                count = value;
            }
        }
    }
结构可以声明构造函数,但他们必须带函数。
结构可以实现接口
结构的访问修饰符可以是public,internal,但不可以是 protected 默认修饰符为internal.
2.枚举
由一组称为枚举数列表的2命名常量组成的独特类型 “列举”是值类型,继承ValueType的.
        枚举类型的图标是两个小标签 
            Console.WriteLine(Sex.男.ToString());   //枚举类型转化成字符串
            // typeof  把某种类型转变成type类型
            从字符串到枚举    string类型要转换的值枚举中必须有值
            Sex s = (Sex)(Enum.Parse(typeof(Sex), "男"));
            从基础数到枚举 
            Sex ss = (Sex)(-1);
            Console.WriteLine(ss);
            //循环遍历
            foreach (string str in Enum.GetNames(typeof(Sex)))
            {
                Console.WriteLine(str);
            }
           enum Sex : uint  //无符号整型
           {
                 男 = 0,
                 女 = 1,
                 人妖 = 2
           }
 
[Flags] 位运算 或运算
static void Main(string[] args) {
Food food = Food.包子|Food.饺子; Console.WriteLine(food);
}
enum Food
    {
        包子=1,
        面条=2,
        饺子=4,
        烧饼=8
    }
static void Main(string[] args)
 {
    Console.WriteLine(Enum.Format(typeof(Days), 1, "G"));
    Console.WriteLine(Enum.Format(typeof(Days), 1, "X"));
    Console.WriteLine(Enum.Format(typeof(Days), 1, "D"));
    Console.WriteLine(Enum.Format(typeof(Days), 1, "F"));
}
enum Days
    {
        周一,
        周二,
        周三,
        周四,
        周五,
        周六,
        周日 
 
    }
 

3.一维数组
Array提供创建,操作,搜索和排序的方法,因此在公共语言运行库中用作所有数组的基类。但是数组是微软定义的,用户使用应当使用有语言提供的数组构造。
 Array MyArr = Array.CreateInstance(typeof(int),5);
            MyArr.SetValue(1,0);
            MyArr.SetValue(2,1);
            foreach (int i in MyArr)
            {
                Console.WriteLine(i);
            }
            //定义简单数组有三种方式
            int[] intarr = new int[3] { 1, 2, 3 };
            int[] intarr2 = new int[] { 1,2,3};
            int[] intarr3 = { 1,2,3};
数组最好用foreach循环,好处多多
原文:http://www.cnblogs.com/ljknlb/p/6419837.html