Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Singletone Class
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { static Program obj=null; private static readonly object objLock=new object(); private Program(){} public static Program GetInstance { get { if(obj==null) { lock(objLock) { if(obj==null){ obj=new Program(); } } } return obj; } } public static void Main(string[] args) { Program obj1=Program.GetInstance; Program obj2=Program.GetInstance; if(obj1.Equals(obj2)) { Console.WriteLine("same object"+" "+obj1.GetHashCode()+" "+ obj2.GetHashCode()); } } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Battle Algorythm
dairkoos
enum.TryParse
adcsasxsd
Enum.IsDefined
D19
Classes, properties, methods, ling begining
Octavia
tablecsv
SingleLinkedList c# operations
Please log in to post a comment.