Daha fazla
- Cinsiyet
- Erkek
- Meslek
- König
Merhaba. Singleton desin pattern ı generic olarak oluşturmak istiyorum. Ama sadece bir instance oluşmuyor. Hangi referanstan oluşturursam o tipten bir instance dönüyor. Bu neden olmaktadır?
C#:
class SVB<T> : ISVB<T> where T:class,new()
{
SVB<T> instance;
List<T> list;
private SVB()
{
list= new List<T>();
}
static SVB()
{
instance = new SVB<T>();
}
public static GetInstance()
{
return instance;
}
}
Son düzenleme: