C# Programming - Namespaces - Discussion

Discussion Forum : Namespaces - General Questions (Q.No. 14)
14.
Which of the following C#.NET code snippets will correctly print "Hello C#.NET"?
import System; 
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        { 
            Console.WriteLine("Hello C#.NET");
        } 
    } 
}
using System;
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[ ] args)
        { 
            WriteLine("Hello C#.NET");
        } 
    } 
}
using System.Console; 
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    { 
        static void Main (string[ ] args)
        { 
            WriteLine("Hello C#.NET");
        } 
    } 
}
using System;
namespace IndiabixConsoleApplication
{ 
    class MyProgram
    { 
        static void Main(string[] args)
        { 
            Console.WriteLine("Hello C#.NET");
        }
    }
}
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
4 comments Page 1 of 1.

Henok said:   7 years ago
Option C: the namespace is importing the Console class, then it imported as " using static System. Console;" rather than "using System. Console; ".

Veyronash said:   1 decade ago
In Option A, System is a namespace and it has to be used with a using keyword and not import.

Radhakrishna said:   1 decade ago
Hello What's wrong with option C?

Sachin said:   1 decade ago
Whats wrong with option [A] ?

Post your comments here:

Your comments will be displayed after verification.