18
I took a project here ASP.NET C# and realize that I can remove several "using".
I can get out of these using
or not?
Did the using
which is not used in class
can be used by someone who is using the class
? No, right?
18
I took a project here ASP.NET C# and realize that I can remove several "using".
I can get out of these using
or not?
Did the using
which is not used in class
can be used by someone who is using the class
? No, right?
19
You can. The directive using
(not to be confused with the command using
which is used to free up resources) is only one way to avoid very large readings and typing.
Visual Studio indicates what can be removed without fear.
All types have namespaces, that is, surnames for them. To use only name and not last name we use the using
, thus all types contained in namespace is available in that code by its name from where the using
is used.
If you don’t use a name like that namespace He is not necessary. Not only does it not create problems, the withdrawal can avoid problems by letting you use something unintentionally available because you left something unnecessarily there. You use thinking it is one thing, but it is another. It is not serious, you will probably notice the error soon, but disturbs.
Since C# 6 it is possible to use the using
for static classes also.
I talked about it in Using unused affect performance?.
16
Right-click (in the code window) to access the option > Organize Usings > Remove Unnecessary Using.
You will not have any problems in your code, as you can add them again.
Some related posts
10
There is no problem in removing them (those that are not being used usually get a less prominent tone), a good alternative to make this and other actions less laborious is the free tool Productivity Power Tools
Every time you save, the tool automatically removes the Unnecessary Using
Browser other questions tagged c# using
You are not signed in. Login or sign up in order to post.
Cool when we learn something super useful isn’t it?! Thanks!
– k2rto4