"using" can be used to change the alias of namespaces. see the code below.
Code
using Terminal = System.Console;
public class TestUsing
{
public static void Main(string[] args)
{
// Defining your own name "Terminal" of "System.Console Class"
Terminal.WriteLine("I am Dangerous");
}
}
Or,
using FileWriting = System.IO.TextWriter;
public class TestUsing
{
public static void Main(string[] args)
{
// Defining your own name "FileWriting" of "System.IO.TextWriter Class"
FileWriting fw = File.CreateText(@"D:\abc.txt");
fw.WriteLine("Hello World!!!");
fw.Flush();
}
}
0 comments:
Post a Comment