PRN212_-_SP_2025_-_FE_3663.webp
P

PRN212_-_SP_2025_-_FE_3663.webp

Kizspy | Question: 10.
(Choose 1 answer)
Identify the correct implementation of the Singleton pattern in C#?
A. public class Singleton
{
private static Singleton instance = null;
private static readonly object lockObject = new object();
private Singleton() {}
public static Singleton Instance
{
get
{
lock (lockObject)
{
if (instance == null)
}
instance new Singleton();
}
return instance;
}
}
}
}
B. public class Singleton
public Singleton() { }
}
C. public class Singleton
{
private static Singleton instance = new Singleton();
Publ. 1
n0 {}
mesatar.co
  • Like
Reactions: Longne12092004

Thông tin

Category
PRN212
Thêm bởi
Phương Thảo1
Ngày thêm
Lượt xem
3,972
Lượt bình luận
12
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom