Basically my question is about the following:
using myName = System.Web;
I recently came across some code which did something very similar to that above.
My question boils down to the following points:
- What is doing this even called?
- Why would you need to this?
- Pros/Cons of doing this?
I understand one of the benefits in which I have used this type of declaration:
using Security = System.Web.Security;
...
_roles = (SimpleRoleProvider)Security.Roles.Provider;
_membership = (SimpleMembershipProvider)Security.Membership.Provider;
As I had an entity named Membership
I couldn't just do Membership.Provider
without a conflict. So here the using declaration allows me to shortern the full use of System.Web.Security.Membership
to just Security.Membership.Provider
which feels nicer from an OCD point of view.