Matthew Layton
Matthew Layton

Reputation: 42390

C# - language-level design patterns

C# allows the Observer Pattern to be implemented via:

Are there any other examples of design patterns that C# implements at the language level?

Upvotes: 0

Views: 154

Answers (1)

Kostya
Kostya

Reputation: 849

  1. foreach loop and IEnumerable - is Iterator Pattern from GoF
  2. C# events are basically an implementation of 'Chain of Responsibility'
  3. Nullable<T> types like int? - are an example of Decorator pattern.

Not exactly a language level but still:

  1. StringBuilder class is an example of GoF Builder pattern.
  2. WPF ICommand - Command pattern from GoF

Upvotes: 2

Related Questions