Danger of "using" multiple namespaces

“Using” namespaces is very convenient as it uncluttered code and cuts down on typing. It is very tempting to add a “using” statement for every namespace we are accessing. However, we then run the risk of having multiple identifiers with the same name. So in practice it is best to reserve “using” statements for namespaces that are heavily used in the code, and skip them when they only would affect an occasional line of code.

Privacy & Terms