sábado, 24 de julho de 2010

Alias to namespaces in C#

I know that probabily you already know how to give an alias to your namespaces references and I know also there is some easy content in the web that explain that.

But this is a little tip that I never thought searching and step on it by chance.

Imagine that you are using two or more control libraries, one is from .NET (Desktop or Web) and the other are from external companies or from the community.

In this case it's very common to find a Label control, for example, in more than one library. So when that happens you'll have something like this:

Imagine calling these references all the time, this is bad for readability and also for the compiler, which have to load the reference in runtime instead of doing it in compile time.

There is a very simple way of not loading this references all the time and improving the readability, that are aliases.

So that is it, I hope you all liked it.


Nenhum comentário: