forked from WeihanLi/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
22 lines (20 loc) · 654 Bytes
/
Copy pathProgram.cs
File metadata and controls
22 lines (20 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
namespace SingletonPattern
{
public class Program
{
public static void Main(string[] args)
{
//0
var i0 = Singleton.GetInstance();
Console.WriteLine($"Singleton {ReferenceEquals(i0, Singleton.GetInstance())}");
//1
var i1 = Singleton1.GetInstance();
Console.WriteLine($"Singleton1 {ReferenceEquals(i1, Singleton1.GetInstance())}");
//2
var i2 = Singleton2.GetInstance();
Console.WriteLine($"Singleton2 {ReferenceEquals(i2, Singleton2.GetInstance())}");
Console.ReadLine();
}
}
}