C#: Namespaces Cheat Sheet

# Defining a Namespace

namespace namespace_name {
   // code declarations
}

To call the namespace-enabled version of either function or variable:

namespace_name.item_name;

# The using Keyword

Console.WriteLine ("Hello there");

Fully qualified name

System.Console.WriteLine("Hello there");

# Nested Namespaces

namespace namespace_name1 {
   
   // code declarations
   namespace namespace_name2 {
      // code declarations
   }
}

Leave a Reply

Your email address will not be published. Required fields are marked *