Wednesday, September 12, 2012

Session Spotlight - T, Earl Grey, Hot: Generics in .NET

I'll be speaking at SoCal Code Camp (Los Angeles) on October 13 & 14.  If you're not signed up yet, head over to the website and let them know that you're coming:

Also, I've got a brand new session: T, Earl Grey, Hot: Generics in .NET

Generics in .NET
Most C# developers have worked with generics to a certain extent (often by using classes from the base class library like List<T>).  But we don't have to stop by merely consuming classes with generics; we can also create our own classes and methods that take advantage of this great framework feature.

We got generics way back in .NET 2.0, and they really were transformational at the time (now we're hopefully used to seeing them).  Using generics, we can add type-safety to our code while still maintaining extensibility.  By making our code type-safe, we are more likely to catch errors at compile time and also avoid strange behavior that might come from casting objects to different types.  Our code also becomes more extensible -- it can work with types that it may not have been originally intended to work with.

Generics also offer us some performance enhancements (which, granted, seem fairly minor when talking about the processing resources of modern devices) by reducing casting calls and boxing/unboxing of value types.

In the session "T, Earl Grey, Hot: Generics in .NET", we'll take a look at the basic features of generics (by comparing non-generic and generic versions of classes from the base class library), see how we can incorporate generics into our own classes and methods in a practical way, and explore the various options to take full advantage of generics in our code (like "default" and generic constraints).

If you can't make it out to the SoCal Code Camp, you have another chance to see this session at the Desert Code Camp (in the Phoenix, AZ area) in November.

Hope to see you at an upcoming event.

Happy Coding!

No comments:

Post a Comment