Click here to Skip to main content
15,867,860 members
Everything / Patterns

Patterns

patterns

Great Reads

by Rahul Rajat Singh
In this article, we will try to understand what is Factory Pattern, what are the benefits of this pattern and how we can implement this pattern using C#.
by Evoluteur
A generic Web User Interface for CRUD applications generating all screens at run-time based on external metadata. It comes with sample applications for address book, memo pad, to do list, restaurants list, wine cellar, and database structure documentation that are easily customizable.
by Mark Pelf
Tutorial article on Fluent Interface Pattern in C#
by fabio bussu
MatchKit is a .NET Library that provides a set of classes to build patterns to match simple and complex strings

Latest Articles

by Dev Leader
Learn how to use Polly in C# to handle faults and retries with ease! Check out three code examples showcasing different use cases of Polly in C#!
by Dev Leader
Learn what the Command Pattern in C# is and the design principles it follows. Understand the pros and cons!
by Stridemann
Example of use of this pattern in game development
by Stridemann
A Pattern for Identifying Processed Entities During Iteration Without Additional Collections

All Articles

Sort by Score

Patterns 

9 Jul 2011 by Paulo Zemek
The easiest singleton pattern is the one you used to the lock object itself.Creating any variable as static readonly and initializing it directly (or via a static constructor) will already make it singleton.Also, considering that "lock" clears all the caches, you don't need to declare the...
7 Nov 2011 by Henry.Ayoola
Jon Skeet has written an article giving six singleton implementations in C#. The simplest only works in .NET 4:public sealed class Singleton{ private static readonly Lazy lazy = new Lazy(() => new Singleton()); public static Singleton Instance {...
2 Feb 2015 by Chris_Yu
Why and When to Use the Adapter Pattern in PHP Development
19 May 2013 by Yossi Yaari
A basic yet generic state machine implementation
22 Jun 2012 by A. Ganzer
Using snippets to create a full and correct implementation of complex interfaces
5 Oct 2011 by Paulo Zemek
All classes are naturally Lazy loaded.So a better implementation will be:public class Singletonwhere T: new(){ public static readonly T Instance = new T();}You will notice that before calling the singleton class, the object will not be loaded.Surely there are...
8 Nov 2011 by jamesklett
You should do it like this:public sealed class MySingleton { public static readonly MySingleton SharedInstance = new MySingleton (); private MySingleton () : base() { }}
11 May 2014 by AllCodify
A Pub/Sub implementation that is PCL compatible for Xamarin iOS and Android
29 Jun 2016 by Priyanka Sabharwal81
Adapter Design Pattern in C++
10 Feb 2016 by Troy W. Locke
The JavaScript Module Pattern used with jQuery
9 Feb 2015 by Veronica S. Zotali
Real example that shows how to implement Observer pattern using IObservable and IObserver
2 Jan 2014 by Viktor Kovács
A simple solution for processing spaceless strings
24 Oct 2013 by Artem Elkin
Thoughts of how implementation inheritance violates Dependency Injection and Dependency Inversion principles.
9 Sep 2013 by Niel M.Thomas
A small tip to retry an action, with an easy to use extension.
6 Nov 2011 by Eddy Vluggen
I'll be shot for posting this as an alternative, but I'm too curious for the answer.Shashank Bisen wrote: Ensure a class only has one instance.Provide a global point of access to it....As stated above, a singleton is a class that can be instantiated once, and only once.What is the...
6 Jul 2011 by Shashank Bisen
A brief explaination of how to implement the Singleton pattern class in multithreading environment.
9 Jul 2015 by Kevan Hadvani
This is my humble effort to explain so called complex Design Patterns to explain as simply as possible
28 Apr 2014 by Marc Leger
Microsoft ASP.NET Identity MerlinFramework
12 May 2014 by MadhureshK
Interface Segregation Principle - Walk through History
24 Apr 2014 by Bankey Sharma
Converting DataReader Result into List of Objects Using Generic Type, Property Attribute and Reflection
7 Aug 2012 by Pankaj Nikam
PRG or Post Redirect Get pattern focuses on solving the typical problem where the user presses F5 or refresh button and causes duplicate database transactions.
3 Sep 2015 by AndyLock
Dynamic, one class fits all factory with no need for specific implementations.
16 Jul 2013 by Atulkumar P Patel
Anti Patterns are wrong practice followed by Developers. They are opposite to Design Patterns.
4 Nov 2013 by Pierre Leclercq
How to implement the master page pattern in WPF?
11 Mar 2014 by Jaume González
To inherit an Entity Framework class, to extend it, bind to data and unmap it from DBContext.
30 Oct 2011 by Paulo Zemek
The problem with alternative 3 and 4 is that it is not multi-threaded.Two threads may check for null, then the two will create the new instance. The race condition only happens at the first accesses. If a single thread accesses the object, then later many threads do the access, there is no...
26 Jul 2012 by Rafael Nicoletti
Refactor C# code to become more expressive
8 Jul 2011 by schamese
This should do it as well:class Singleton { public static readonly Singleton m_Instance = new Singleton(); // Prevent instance creation from other classes private Singleton() { } public static Singleton Instance { get { return m_Instance; } }}And it is "Singleton",...
30 Oct 2013 by Marc Leger
ORM, databinding, asynchronous data access, and transactions
4 Nov 2013 by arturomonriv
No more factories in C#.
20 Aug 2013 by Jitendra Ballia
Building data access layer using enterprise library
27 Oct 2011 by ForgaSw
Another alternative: class Singleton { public static Singleton m_Instance; //Prevent instance creation from other classes private Singleton() { } public static Singleton Instance { get { return m_Instance ?? (m_Instance = new Singleton()); } ...
17 Oct 2011 by omid rezaei hanjani
Customized implementation of the Singleton pattern using Generics.
6 Nov 2011 by Kabwla.Phone
Make it a generic class and fix your problem forever. This works because the compiler turns the generic into a new class (something like SigletonManagerOfTypeParamterTypeName). So the static variables are not shared amongst instances...public static class Singleton where...
1 Oct 2011 by omid rezaei hanjani
Customized implementation of the Observer pattern using Generics.