C# program to create a user defined the namespace
The source code to create a user define namespace is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | //C# program to create a user defined the namespace using System; namespace Test.Namespace { class Sample { public static void Swap(ref int X, ref int Y) { int Z = 0; Z = X; X = Y; Y = Z; } } } class Program { static void Main() { int X = 10; int Y = 20; Console.WriteLine("Before swapping : X " + X + ", Y " + Y); Test.Namespace.Sample.Swap(ref X, ref Y); Console.WriteLine("After swapping : X " + X + ", Y " + Y); Console.WriteLine(); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.