c#學習筆記之命名空間

1.在c#文件頭寫using 語句

2.命名空間的別名例子:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Introduction = Gychan.Test;
namespace test
{
    class Program
    {
         static void Main(string[] args)
        {
           
            #region namespace
            Introduction::StudyExample test = new Introduction.StudyExample();
            Console.WriteLine(test.GetNameSpace());
            Console.ReadLine();
            #endregion
        }
     
        
    }
}
namespace Gychan.Test
{
    class StudyExample
    {
        public string GetNameSpace()
        {
            return this.GetType().Namespace;
        }
    }
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章