- 1
Why to use using in the code
8 Answers
+ 1
What code?
+ 1
C# is a very powerful language that is great in running Data on a server, making applications on a computer or even being a server.
C# is a lot like Java
+ 1
What is your question ?
A) Why to use code
B) What is using(){} and when do you use it ?
Can you give a example ?
+ 1
do you mean for example
"using system.IO;"
?
0
in java programming the strating statement is package ...... in c# programming also the programme is also starting with using .... so my question is why "using" is used in c# programme
0
yrs
0
yes*
0
now I understand. The using directive.
It is a shortcut label to the libraries that are referenced.
if you have a line
using System;
Console.WriteLine("hello world");
if you also may write
using System.Console;
WriteLine("hello world");
If you use WriteLine a lot, it saves you from typing.
And there is a lot less code
On the otherside it can be confusing, because you can't read from which class the WriteLine is
Also a WriteLine from a other class can give conflicts if you do not type the full name.
https://csharp.today/c-tutorial-namespace-and-using-directive/



