Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(This question was closed on Stack Overflow due to being "too broad" and "not a real question" so maybe it's more appropriate here?)

Inspired by this question. We know events are a language-level implementation of the Observer pattern. Are there other design patterns implemented as language features in C#? I want to keep this question C#-specific because there are lots of design patterns implemented in other languages, and I want to keep this focused.

I'm not looking for pattern implementations in the BCL (such as decorator in many WCF classes or Factory Method in WebClient), but language-level patterns.

So far I'm aware of observer (event) and iterator (foreach in combination with many BCL classes and interfaces). There are probably other obvious ones I'm missing.

share|improve this question

Delegates are de facto strategy patterns

share|improve this answer
funny, just yesterday a collegue was saying delegates are an implementation of the command pattern. Depends on how you look at it I guess (afaik command should encapsulate the arguments as well, but in case of a method without arguments..) – stijn Mar 25 '11 at 8:20
I wouldn't say delegates are implementation of command patterns, atleast I can't see how you could implements things like undo/redo using only delegates. They might be part of a command object but that's another matter – konrad Mar 25 '11 at 8:41

Extension methods are an abstraction of the Decorator pattern.

share|improve this answer
Not really. Decorator allows us to composed objects at run-time to add data and behaviour. – Martin Doms Mar 25 '11 at 19:28
True - so they're not nearly as useful as real decorator patterns. Would it be better to say that much of the problems solved by extension methods are solved with decorator patterns in other languages? – vstrien Mar 28 '11 at 10:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.