Right-click your main hard drive (usually the C: drive) and select Properties. Click the Disk Cleanup button and you'll see a list of items that can be removed, including temporary files and more. For even more options, click Clean up system files. Tick the categories you want to remove, then click OK > Delete Files.
In the search box on the taskbar, type disk cleanup, and select Disk Cleanup from the list of results. Select the drive you want to clean up, and then select OK. Under Files to delete, select the file types to get rid of. To get a description of the file type, select it.
Windows suggests different types of files you can remove, including recycle bin files, Windows Update Cleanup files, upgrade log files, device driver packages, temporary internet files, and temporary files.
There are few reasons for removing unused using(s)/namespaces, besides coding preference:
What removing the unused namespaces won't do:
The resulting assembly is the same with or without unused using(s) removed.
It won't change anything when your program runs. Everything that's needed is loaded on demand. So even if you have that using statement, unless you actually use a type in that namespace / assembly, the assembly that using statement is correlated to won't be loaded.
Mainly, it's just to clean up for personal preference.
Code cleanliness is important.
One starts to get the feeling that the code may be unmaintained and on the browfield path when one sees superfluous usings. In essence, when I see some unused using statements, a little yellow flag goes up in the back of my brain telling me to "proceed with caution." And reading production code should never give you that feeling.
So clean up your usings. Don't be sloppy. Inspire confidence. Make your code pretty. Give another dev that warm-fuzzy feeling.
There's no IL construct that corresponds to using
. Thus, the using
statements do not increase your application memory, as there is no code or data that is generated for it.
Using
is used at compile time only for the purposes of resolving short type names to fully qualified type names. Thus, the only negative effect unnecessary using
can have is slowing the compile time a little bit and taking a bit more memory during compilation. I wouldn't be worried about that though.
Thus, the only real negative effect of having using
statements you don't need is on intellisense, as the list of potential matches for completion while you type increases.
You may have name clashes if you call your classes like the (unused) classes in the namespace. In the case of System.Text, you'll have a problem if you define a class named "Encoder".
Anyways this is usually a minor problem, and detected by the compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With