Namespaces in C## are used to organize code. Think of them as containers for related classes, methods, and objects.
System.Console.WriteLine("System is a namespace");
In the above line, System
is a namespace and Console
is a class in that namespace.
We include specific namespaces in a given .cs file with the using
keyword. A very basic but complete .cs file will have a set of using statements, the namespace for the file, a class or other object, and any members of that object.
using System;
namespace ProgramName //Namespace
{
class Program //Class
{
public static void Main() //Class member
{
Console.WriteLine("Starting application...");
}
}
}
#c# in simple terms #c++