1.

Why do we write “using” in a C# Program?

Answer»

The using keyword in C# is used to specify the NAMES of the namespaces that are used in the given program. For example - The System namespace is used in the programs with the keyword using.

A program that demonstrates the using keyword in C# is given as FOLLOWS:

using System; namespace Demo {    class Test    {      STATIC VOID Main(string[] args)      {         int a, b, sum;         a = 14;         b = 2;         sum = a + b;         Console.WriteLine("The sum of {0} and {1} is {2}", a, b, sum);      }    } }

The output of the above program is as follows:

The sum of 14 and 2 is 16


Discussion

No Comment Found