对C#的类的了解,自己的笔记贴

对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 = LeafSoft.EnumType.CMDType.ASCII;
            LeafSoft.a_class 对象 = new LeafSoft.a_class();
            对象.shuxing1 = "set_value";
            Console.WriteLine();
        }
    }
}


创建一个类:
        成员变量
        string member_a = "chushihua_value_a";
        string member_b = "chushihua_value_b";


与类名相同的函数是该类的构造函数
        public a_class()
        {
            member_a = "gouzao_a";
        }


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