Name Clashes Due to Imports
Because namespaces were invented to resolve name clashes in some flat global namespace (for example, as seen in Win32), they allow for types with the same (short) name to exist in different namespaces existing alongside each other. When multiple such namespaces containing a type with the same name are imported, a conflict will occur when trying to refer to that particular type.
For example, when adding references to both System.Drawing and WindowsBase (the former of which is used by Windows Forms and the latter by Windows Presentation Foundation), multiple definitions of a Point type exist (among many others, such as Size). Figure 24.10 shows the Resolve feature in Visual Studio that can be used to resolve a type name ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access