You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			20 lines
		
	
	
		
			389 B
		
	
	
	
		
			C#
		
	
		
		
			
		
	
	
			20 lines
		
	
	
		
			389 B
		
	
	
	
		
			C#
		
	
| 
											2 years ago
										 | namespace Game | ||
|  | { | ||
|  |     public abstract class Singleton<T> where T : new() | ||
|  |     { | ||
|  |         private static T _instance; | ||
|  |         public static T Instance | ||
|  |         { | ||
|  |             get | ||
|  |             { | ||
|  |                 Create(); | ||
|  |                 return _instance; | ||
|  |             } | ||
|  |         } | ||
|  |         public static void Create() | ||
|  |         { | ||
|  |             _instance ??= new T(); | ||
|  |         } | ||
|  | 
 | ||
|  |     } | ||
|  | } |