Namespaces

A namespace helps you to divide and conquer the complexity of the object hierarchy.
The .NET Framework organises its classes into namespaces
examples SS


Avoid defining types in the global namespace
The same namesapce can exist in multiple files
It is possible to nest namespace declarations


A collection of logically related types
Namespaces can be nested
avoids name conflicts
can include dots to indicate a hierarchical structure


namespace Better1 
{
   namespace MyDataStructures
   {
      namespace MyArrays
      {
      }
   }
}

is the same as

namespace Better1.MyDataStructures.MyArrays 
{
}



Default / Global Namespace

Any classes or code that is not explicitly added to an explicit namespace is contained in the global namespace





Everything is an object that derives from the root class System.Object


Microsoft.CSharp namespace ?

This namespace contains classes that support compilation and code generation using th C# language.


C# Highlights

Case sensitive
Statememts are terminated with a semi-colon
Variables are declared after the datatype
Curly brackets are used to delimit everything around all code blocks - more consistent
Allow unmanaged code to be called
No line continuation character
Less syntax - short and to the point.
Has no implicit type conversion
Must add parentheses to subroutines manually
String concatenation is done using "+"
Less automatic formatting than VB.NET
Only supports late binding through Reflection
Does not support parameterized properties


© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited

Top

PrevNext