O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required