The videos and slides from TechEd 2004 are now available online at:
http://microsoft.sitestream.com/teched2004/
(Note: You have to click on the session titles to watch video - and each takes a while to load.)
Now, I'm off to watch the videos from those numerous sessions I couldn't attend because they conflicted with other sessions!
-Chris
UPDATE: Unfortunately, these have been taken offline.
UPDATE: The above link is still offline, but if you attended TechEd, you can use your CommNet login to access the materials at:
http://microsoft.sitestream.com/teched/
Most people understand that the C# using directive allows creation of an alias as a shortcut to a particular namespace:
using MAE = Microsoft.ApplicationBlocks.ExceptionManagement;
...
MAE.ExceptionManger.Publish(exp);
Many people know that this can also be used to alias a particular class:
using EM = Microsoft.ApplicationBlocks.ExceptionMangagement.ExceptionManager;
...
EM.Publish(exp);
I had never thought to look any deeper than that until I saw how ugly our code was getting when consuming some long enumeration names which had been generated via a tool. It turns out that using can create aliases to enumerations (and delegates or contained classes) of a class as well!
For example (ignoring the hideousness of the contrived example logic,) compare having:
public void AmazingFeature(ObnoxiouslyLongGeneratedEnumerationName mysteryFactor)
{
if ((mysteryFactor > ObnoxiouslyLongGeneratedEnumerationName.Second) && (mysteryFactor < ObnoxiouslyLongGeneratedEnumerationName.Fifth))
//...
Versus:
using
OLGEN = Experiment.TestClass.ObnoxiouslyLongGeneratedEnumerationName;
public
void AmazingFeature(OLGEN mysteryFactor)
{
if ((mysteryFactor > OLGEN.Second) && (mysteryFactor < OLGEN.Fifth))
//...
This should help us keep our lines of code shorter and easier to maintain. I hope this helps you, too!
-Chris