Posted on Wednesday January 28, 2009

C# Design patterns: the Strategy pattern

Summary

Multiple classes implement an interface, handling an algorithm in a different way.

Example

Sorting is the clearest working example of the Strategy pattern. In .NET you’ll find it in the IComparer interface alongside Array.Sort/LINQ, see the links section for an article on this on MSDN.