日期:2014-05-17  浏览次数:20927 次

对C#的类的理解,自己的笔记贴
namespace LeafSoft
{
    public class EnumType
    {
        /// <summary>
        /// 命令类型
        /// </summary>
        public enum CMDType
        {
            Hex,
            ASCII
        }

    }

    public class a_class
    {
        //成员变量
        string member_a = "chushihua_value_a";
        string member_b = "chushihua_value_b";

        //构造函数
        public a_class()
        {
            member_a = "gouzao_a";
        }
        //成员函数
        public void func()
        {
            Console.WriteLine("duixiang");
        }

        //类的对象的属性
        public string shuxing1
        {
            get
            {
                return member_a;
            }
            set
            {
                member_a = value;
            }
        }


        public string shuxing2
        {
            get
            {
                return "b";
            }
        }
    }
}

namespace ConsoleApplication2
{
    class Program
    {
        
        static void Main(string[] args)
        {
            LeafSoft.EnumType.CMDType lec