I don't know how many times I have implemented the Singleton Design Pattern in C#, but it was starting to get old...

So I Googled the net, looking for something I could re-use. I found this excellent article, and adapted it to use Generics. This is what I came up with:

using System;

namespace TT
{
     #region Singleton<T>
     /// <summary>  /// Provides a Singleton implementation using Generics.  /// </summary>  /// <typeparam name="T">Type of singleton instance</typeparam>  public  sealed  class Singleton<T>  where T :  new() {
        Singleton() {}

         public  static T Instance {
            get {
                 return Nested.instance;
            }
        }

         class Nested ...

One of the things I have come to love about Linq is how you can focus more on declarative programming: focusing on what you want to accomplish rather than how.

See for example below - I have a generic list of SolutionDescriptor instances (a class in my project that describes a position in a Visual Studio solution), and want to search if for the best match to the language and Visual Studio version preferences in a UserProfile instance:

Note the three queries against the List, each one a Linq expression, starting with an attempt at an exact match, then  ...