In addition to Solution 1:
First of all, make sure you really need both types in the same file. It may happen that one is just a remnant of old code. With Visual Studio, it's always useful to do this: show popup menu in the code editor and use "
Organize Usings" => "
Remove Unused Usings". Don't overuse "using". :-)
But it's possible that you really use both types in one code file. So, namespaces…
Now, understanding of namespaces is one of the basics things you need. You cannot do any programming without full understanding. The error message tells you clearly what's wrong. You just need to read on the topic: .
In addition to the technique showed in Solution 1, you can use
alias using directive (not to be mixed up with
using statement!):
https://msdn.microsoft.com/en-us/library/sf0df423.aspx[
^]:
using WebImage = System.Web.UI.WebControls.Image;
using DrawingImage = System.Drawing.Image;
WebImage image =
DrawingImage image =
You can choose any of the ways, or combine them, depending on your sense of readability and personal taste.
—SA