C-Sharp Factory Pattern

March 23, 2024

C# & .NET

C-Sharp Factory Pattern

Thuta Sann

Thuta Sann

Factory Pattern Generic class in C#


Share This Snippet To :

Factory Pattern in C#

public static class FactoryPattern<K, T> where T : class, K, new() { public static K GetInstance() { K objK; objK = new T(); return objK; } }

Cookie

I baked some cookies that you have to accept, if you want to enjoy my portfolio.
In order to gather information and make improvements, I should use some third-party cookies too, Can I?