Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
GeneralRe: Generic Question Pin
J4amieC22-Jul-09 23:55
J4amieC22-Jul-09 23:55 
First thing i'd do if I were you is go and read up on the singleton design pattern. The class you have found/written is for that purpose, and that purpose alone. You may have accidentally stumbled upon a tried-and-tested pattern of software design. Thats usually how you come accross such things and will make you a better programmer.

In answer to your question, you would use the fields/methods of your class as follows - assume the "T" passed in is the class MyClass which has an instance method void Foo() and an instance property int Bar.
Singleton<MyClass> singleton = new Singleton<MyClass>();
singleton.Instance.Foo();
singleton.Instance.Bar = 5


Crucially, you would never access a static property/method on MyClass, only instance properties/methods. Thats by convention of course, as I stated originally there is nothing stopping you referencing a static member, MyClass.StaticProperty
GeneralRe: Generic Question Pin
Programm3r23-Jul-09 0:00
Programm3r23-Jul-09 0:00 
GeneralRe: Generic Question Pin
harold aptroot22-Jul-09 23:12
harold aptroot22-Jul-09 23:12 
GeneralRe: Generic Question Pin
Programm3r22-Jul-09 23:30
Programm3r22-Jul-09 23:30 
GeneralRe: Generic Question Pin
J4amieC22-Jul-09 23:33
J4amieC22-Jul-09 23:33 
GeneralRe: Generic Question Pin
Programm3r22-Jul-09 23:45
Programm3r22-Jul-09 23:45 
GeneralRe: Generic Question Pin
J4amieC22-Jul-09 23:55
J4amieC22-Jul-09 23:55 
AnswerRe: Generic Question Pin
PIEBALDconsult23-Jul-09 6:25
mvePIEBALDconsult23-Jul-09 6:25 
QuestionDebugging ASP.NET web application Pin
Chesnokov Yuriy22-Jul-09 21:36
professionalChesnokov Yuriy22-Jul-09 21:36 
AnswerRe: Debugging ASP.NET web application Pin
Vimalsoft(Pty) Ltd23-Jul-09 1:15
professionalVimalsoft(Pty) Ltd23-Jul-09 1:15 
QuestionGlass on MDI container Pin
see_seA22-Jul-09 21:29
see_seA22-Jul-09 21:29 
AnswerRe: Glass on MDI container Pin
see_seA27-Jul-09 12:04
see_seA27-Jul-09 12:04 
AnswerRe: Glass on MDI container Pin
lakhy lakhyan26-Apr-10 7:41
lakhy lakhyan26-Apr-10 7:41 
QuestionRun another Application out of my Application - with the same rights Pin
ss2022-Jul-09 21:24
ss2022-Jul-09 21:24 
Questioninsert date and time in oracle Pin
mjawadkhatri22-Jul-09 20:37
mjawadkhatri22-Jul-09 20:37 
AnswerRe: insert date and time in oracle Pin
Nagy Vilmos22-Jul-09 22:53
professionalNagy Vilmos22-Jul-09 22:53 
GeneralRe: insert date and time in oracle Pin
mjawadkhatri23-Jul-09 0:42
mjawadkhatri23-Jul-09 0:42 
GeneralRe: insert date and time in oracle Pin
Nagy Vilmos23-Jul-09 6:30
professionalNagy Vilmos23-Jul-09 6:30 
Questioni need to get Alert mail in inbox when one perticular News(ex: about Tata steel Ltd.) updated Pin
ravindarp22-Jul-09 20:09
ravindarp22-Jul-09 20:09 
AnswerRe: i need to get Alert mail in inbox when one perticular News(ex: about Tata steel Ltd.) updated Pin
Nagy Vilmos22-Jul-09 23:09
professionalNagy Vilmos22-Jul-09 23:09 
GeneralRe: i need to get Alert mail in inbox when one perticular News(ex: about Tata steel Ltd.) updated Pin
ravindarp22-Jul-09 23:31
ravindarp22-Jul-09 23:31 
GeneralRe: i need to get Alert mail in inbox when one perticular News(ex: about Tata steel Ltd.) updated Pin
Nagy Vilmos23-Jul-09 0:24
professionalNagy Vilmos23-Jul-09 0:24 
GeneralRe: i need to get Alert mail in inbox when one perticular News(ex: about Tata steel Ltd.) updated Pin
ravindarp23-Jul-09 0:45
ravindarp23-Jul-09 0:45 
QuestionShow the list of users at each client Pin
tamir90122-Jul-09 19:55
tamir90122-Jul-09 19:55 
AnswerRe: Show the list of users at each client Pin
Tamer Oz22-Jul-09 20:21
Tamer Oz22-Jul-09 20:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.