C#,命名空间的别名

    技术2022-08-01  61

    c#中可以给命名空间起个别名。

    //将system别名 using sys = System; //和程序名相同的命名空间 //在常见项目时就自动生成 namespace the_second_helloworld { //类program,在创建项目时自动生成 class Program { //主函数,程序执行的起点 static void Main(string[] args) { int[] arr = { 0,1,2}; foreach(int i in arr) { //别名后,必须写sys:: sys::Console.WriteLine(i); } } } } 运行结果: 0 1 2
    Processed: 0.010, SQL: 10