Is it possible to remove references to System.Web.UI.*?
This may be a dumb question, but is it possible to remove references to System.Web.UI.*
? For example, my application has two custom classes that are called Panel
and Control
, but I can't refer to them as such in the code because they conflict with the classes i开发者_开发百科n System.Web.UI
.
Since I'm working in an ASP.NET MVC environment, I won't have a need for the controls provided in that namespace, so it would be wonderful if I can remove references to it so I can type the short-hand references to my classes.
If it matters, it's a ASP.NET MVC 2 .NET 4 application.
Not really, no. You can remove references to assemblies, but not namespaces. They are part of the System.Web assembly, which you need for a web application. I'd recommend refactoring your controls to have different names.
You can declare synonyms to namespaces.
using DotNetControls= System.Web.UI.*;
And just don't use DotNetControls
.
I think You can also use code snippets to declare for example that panel
will become MyNamespace.Panel
精彩评论