1.清单6-1. The C# Station Namespace: NamespaceCSS.cs |
// Namespace Declaration using System; // The C# Station Namespace namespace csharp_station { // Program start class class NamespaceCSS { // Main begins program execution. public static void Main() { // Write to console Console.WriteLine("This is the new C# Station Namespace."); } } } |
说明 |
2.清单6-2 Nested Namespace 1: NestedNamespace1.cs |
// Namespace Declaration using System; // The C# Station Tutorial Namespace namespace csharp_station { namespace tutorial { // Program start class class NamespaceCSS { // Main begins program execution. public static void Main() { // Write to console Console.WriteLine("This is the new C# Station Tutorial Namespace."); } } } } |
说明 |
3.清单6-3. Nested Namespace 2: NestedNamespace2.cs |
// Namespace Declaration using System; // The C# Station Tutorial Namespace namespace csharp_station.tutorial { // Program start class class NamespaceCSS { // Main begins program execution. public static void Main() { // Write to console Console.WriteLine("This is the new C# Station Tutorial Namespace."); } } } |
说明 |
4.清单6-4. Calling Namespace Members: NamespaceCall.cs |
// Namespace Declaration using System; namespace csharp_station { // nested namespace namespace tutorial { class myExample1 { public static void myPrint1() { Console.WriteLine("First Example of calling another namespace member."); } } } // Program start class class NamespaceCalling { // Main begins program execution. public static void Main() { // Write to console tutorial.myExample1.myPrint1(); csharp_station.tutorial.myExample2.myPrint2(); } } } // same namespace as nested namespace above namespace csharp_station.tutorial { class myExample2 { public static void myPrint2() { Console.WriteLine("Second Example of calling another namespace member."); } } } |
说明 |
5.清单6-5. The using Directive: UsingDirective.cs |
// Namespace Declaration using System; using csharp_station.tutorial; // Program start class class UsingDirective { // Main begins program execution. public static void Main() { // Call namespace member myExample.myPrint(); } } // C# Station Tutorial Namespace namespace csharp_station.tutorial { class myExample { public static void myPrint() { Console.WriteLine("Example of using a using directive."); } } |
说明 |
6.清单6-6. The Alias Directive: AliasDirective.cs |
// Namespace Declaration using System; using csTut = csharp_station.tutorial.myExample; // alias // Program start class class AliasDirective { // Main begins program execution. public static void Main() { // Call namespace member csTut.myPrint(); myPrint(); } // Potentially ambiguous method. static void myPrint() { Console.WriteLine("Not a member of csharp_station.tutorial.myExample."); } } // C# Station Tutorial Namespace namespace csharp_station.tutorial { class myExample { public static void myPrint() { Console.WriteLine("This is a member of csharp_station.tutorial.myExample."); } } } |
说明 |
相关视频
相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么
热门文章 去除winrar注册框方法
最新文章
比特币病毒怎么破解 比去除winrar注册框方法
华为无线路由器HG522-C破解教程(附超级密码JEB格式文件京东电子书下载和阅读限制破解教UltraISO注册码全集(最新)通过Access破解MSSQL获得数据
人气排行 华为无线路由器HG522-C破解教程(附超级密码JEB格式文件京东电子书下载和阅读限制破解教UltraISO注册码全集(最新)qq相册密码破解方法去除winrar注册框方法(适应任何版本)怎么用手机破解收费游戏华为无线猫HG522破解如何给软件脱壳基础教程
查看所有0条评论>>