private static void Main(string[] args) { // TAKE ONE var buffer = new CircularBuffer <double>(); //ProcessInput(buffer); // TAKE TWO // Some scenarios where extension of buffer is needed // Avoid coding agains a concrete class, instead code against an interface var bufferInterface = new CircularBufferByInterface <double>(); ProcessBufferByInterface(bufferInterface); // And I can use different Buffer without changing client code var queueBuffer = new QueueBuffer <double>(); ProcessBufferByInterface(queueBuffer); // TAKE THREE // Enumerating a buffer - IEnumerable has been implemented // Now i'm able to use foreach foreach (var item in queueBuffer) { Console.WriteLine(item); } // TAKE FOUR - ADDING <TOutput> METHOD // TOutput will return different TOutput type than Buffer<T> type var asInts = queueBuffer.AsEnumerableOf <int>(); ProcessInputByInterface(queueBuffer); foreach (var item in queueBuffer) { Console.WriteLine(item); } // TAKE FIVE - ADDING EXTENSION METHOD that returns <TOutput) var asInts2 = queueBuffer.AsEnumerableOfExtension <double, int>(); ProcessInputByInterface(queueBuffer); // TAKE SIX - ADDING ANOTHER EXTENSION (VOID) method queueBuffer.Dump(); }