I recently asked a question: What Does :: Mean?
Then today, of course I ran into that exact problem. Going off the top of my head I think I was using both the System.Timers and System.Threading namespaces. As far as I can remember they both have a class called Timer. Now that’s irrelevant what I want to know is what’s the difference between the following:
Using myalias = System.Timers;
myalias::Timer myTimer = new myalias::Timer();
and
Using System.Timers;
System.Timers.Timer myTimer = new System.Timers.Timer();
I hope this is clear enough, I just want to know why use :: when you can just type the namespace out is it just to save typing incase you have a lot of nested namespaces?
It’s not about difference, it’s a way of using the types that are in collision.
If you use some type
begin to use some other project that has
Two types
Projectare in collision, so istead of writing fully qualified name, you assign a alias to yuor, and/or to his namespace. This is just for comfort, for coding style.