Sunday, June 07, 2009

Hidden C# Feature: Using Alias Directive

You can create an alias to a long namespace or a type like so:

using Project = SolutionName.Data.Project;

Then you use the Alias in place of the namespace:

Project p = new Project();

I wish I would of known about this last summer, probably could of shaved a month off my project just from not having to type in the long namespaces to our data layer.

Related Links:

using Directive (C# Reference)
Hidden Features of C#

Comments are closed.

Blog Posts by:

Currently Viewable:

The Official jQuery Podcast

with Ralph Whitbeck & Elijah Manor

You can subscribe to the show in iTunes or via the raw RSS feed

My Twitter Updates

View Twitter Page