Tuesday, 1 July 2008

C# From the beginning

In C/C++ the output uses printf. In Java it uses System.out.println. Now we are in C# and it uses Console.Writeln.

There is a keyword, region, which can be used to collapse lines of code into a single line.

Namespace has been used in C#. It has been also used in C++ and Java. By default the global namespace is applied. The keyword is namespace.

Follows are namespace examples,

namespace LevelOne
{
 // "NameOne" define
}

In global namespace, it needs to be used as LevelOne.NameOne.

For nested namespace,
namespace LevelOne
{
 namespace LevelTwo
 {
 // "NameTwo" define
 }
}

To use NameTwo in global namespace, it should be used as LevelOne.LevelTwo.NameTwo.

No comments: