So is the following equivalent in memory usage?
System.Threading.Thread.Sleep(500);
vs
using System.Threading;
...
Thread.Sleep(500);
I would have thought that the less namespaces you're 'using' in memory the better, but I've heard that the former example has to load the namespace into memory regardless. I know Sleep isn't the best example of a memory hungry method but it's just an example.
The using statement doesn't cause anything at all to be loaded, it only tells the compiler where to look for classes.
The two examples produces exactly the same code.
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