码迷,mamicode.com
首页 > 其他好文 > 详细

7.4 命名空间别名

时间:2018-11-28 23:43:12      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:div   全局   命名   pre   inf   ram   []   span   string   

7.4.1 限定的命名空间别名

 1 using WinForm = System.Windows.Forms;
 2 
 3 namespace Test01
 4 {
 5     class WinForm { }
 6     class Program
 7     {
 8         static void Main(string[] args)
 9         {
10             Console.WriteLine(typeof(WinForm::Button));
11             Console.ReadKey();
12         }
13     }
14 }

7.4.2 全局命名空间别名

 1 using System;
 2 class Configuration { }
 3 namespace Test01
 4 {
 5     class Configuration { }
 6     class Program
 7     {
 8         static void Main(string[] args)
 9         {
10             Console.WriteLine(typeof(Configuration));
11             Console.WriteLine(typeof(global::Configuration));
12             Console.WriteLine(typeof(global::Test01.Configuration));
13             Console.ReadKey();
14             /*
15             Test01.Configuration
16             Configuration
17             Test01.Configuration
18              */
19         }
20     }
21 }

 

7.4 命名空间别名

标签:div   全局   命名   pre   inf   ram   []   span   string   

原文地址:https://www.cnblogs.com/kikyoqiang/p/10035546.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!