例子:
public class ParmeraSingleton { private static ParmeraSingleton instance = null; public int x, y; private ParmeraSingleton(int x, int y) { this.x = x; this.y = y; } public static ParmeraSingleton GetInstance(int x, int y) { if (instance == null) { instance = new ParmeraSingleton(x, y); } else { instance.x = x; instance.y = y; } return instance; } } public class Program { public static void Main(string[] args) { ParmeraSingleton s1, s2; s1 = ParmeraSingleton.GetInstance(1, 2); s2 = ParmeraSingleton.GetInstance(2, 3); Console.WriteLine(object.ReferenceEquals(s1, s2)); } }