Using Generic Constraints & Default

Here is a great video from one of my buddies, Jeremy Clark, on generic constraints and default: Here is an extension method I made from Jeremy's second example: public static T Max<T>(this T obj1, T obj2) where T : IComparable {     if obj1.CompareTo(obj2) >= 0 ? return obj1 : return obj2; }

dotNetDave Rocks Visual Studio Live! Orlando 2014

For the first time the  dotNetDave "Rock The Nation Tour" is coming to Visual Studio Live! in Orlando on November 17-24th! I hope you will attend my sessions below. Röck Yoür Cöde Using Code Contracts This session will introduce developers to the new powerful new feature that is part of the .NET 4.5 framework called … Continue reading dotNetDave Rocks Visual Studio Live! Orlando 2014

Formatting LINQ Statements

Language-Integrated Query (LINQ) was introduced in Visual Studio 2008/ .NET 3.5 and was actually one of my favorite features. It makes writing queries so much easier, especially for XML and object collections. Even though Visual Studio 2013 auto-formats the queries better, there is even a even better way to make them more readable. Here is … Continue reading Formatting LINQ Statements

Using StyleCop from Microsoft

When I speak at conferences, I am always amazed on how many C# programmers do not use StyleCop from Microsoft! C'mon, it's FREE! This Visual Studio add-in helps you to format your code to look consistent among your developers... just like Microsoft does.