Using directive in c#

Using directive in c#

C# Example with using static directive

using static System.Console;

namespace usingcsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            WriteLine("usingcsharp.com");
            ReadLine();
        }
    }
}

C# Example without using static directive

using System;  
namespace usingcsharp
{  
    class StaticClass  
    {  
        public static void Main(string[] args)  
        {  
            double sqrt   = Math.Sqrt(169);
            string Str = String.Concat("usingcsharp",".com");  
            Console.WriteLine(sqrt);  
            Console.WriteLine(Str);  
        }  
    }  
}  

Output

13
usingcsharp.com


2021-10-03