Click here to Skip to main content
15,902,447 members
Home / Discussions / C#
   

C#

 
AnswerRe: Best C# book? Pin
Vipin Venugopal1-Aug-06 1:38
Vipin Venugopal1-Aug-06 1:38 
AnswerRe: Best C# book? Pin
Xodiak1-Aug-06 5:28
Xodiak1-Aug-06 5:28 
QuestionWindows form instance calculation Pin
chandler831-Aug-06 0:16
chandler831-Aug-06 0:16 
AnswerRe: Windows form instance calculation Pin
stancrm1-Aug-06 0:37
stancrm1-Aug-06 0:37 
GeneralRe: Windows form instance calculation Pin
chandler831-Aug-06 0:54
chandler831-Aug-06 0:54 
GeneralRe: Windows form instance calculation Pin
stancrm1-Aug-06 0:57
stancrm1-Aug-06 0:57 
GeneralRe: Windows form instance calculation Pin
chandler831-Aug-06 1:02
chandler831-Aug-06 1:02 
AnswerRe: Windows form instance calculation Pin
Shy Agam1-Aug-06 10:25
Shy Agam1-Aug-06 10:25 
I would say that the prefered OOP style way is to use a Singleton object.
A Singleton object is an object with no visible constructors.
You declare every constructor as private, thus hiding them all.
In order to get your single instance of the class, you create a static function which checks if an instance was already created.
If it was, you return that existing instance.
If not, you create a new one and return it.

Example:
public class SingletonClass
{
    SingletonClass instance;

    private SingletonClass()
    {
        // Initialization code
    }

    public static SingletonClass GetInstance()
    {
        if (instance = null)
            instance = new SingletonClass();
        
        return instance;
    }
}

Questionhow to retrive image from sql server database in asp.net 2.0 Pin
vivekdeshpande1-Aug-06 0:14
vivekdeshpande1-Aug-06 0:14 
QuestionSingleton Pattern [modified] Pin
Legolas_Bilbao31-Jul-06 23:50
Legolas_Bilbao31-Jul-06 23:50 
AnswerRe: Singleton Pattern Pin
Colin Angus Mackay1-Aug-06 0:08
Colin Angus Mackay1-Aug-06 0:08 
AnswerRe: Singleton Pattern Pin
Xodiak1-Aug-06 5:39
Xodiak1-Aug-06 5:39 
GeneralRe: Singleton Pattern [modified] Pin
Legolas_Bilbao1-Aug-06 7:01
Legolas_Bilbao1-Aug-06 7:01 
QuestionDisabling the 'X' button in the caption bar Pin
Dario Solera31-Jul-06 23:47
Dario Solera31-Jul-06 23:47 
AnswerRe: Disabling the 'X' button in the caption bar Pin
Vipin Venugopal31-Jul-06 23:51
Vipin Venugopal31-Jul-06 23:51 
AnswerRe: Disabling the 'X' button in the caption bar Pin
Rahul.RK1-Aug-06 0:06
Rahul.RK1-Aug-06 0:06 
GeneralRe: Disabling the 'X' button in the caption bar Pin
Dario Solera1-Aug-06 0:28
Dario Solera1-Aug-06 0:28 
AnswerRe: Disabling the 'X' button in the caption bar Pin
stancrm1-Aug-06 0:33
stancrm1-Aug-06 0:33 
GeneralRe: Disabling the 'X' button in the caption bar Pin
Dario Solera1-Aug-06 0:59
Dario Solera1-Aug-06 0:59 
QuestionData Grid Table Style Allowsorting property Pin
indiaone31-Jul-06 23:44
indiaone31-Jul-06 23:44 
AnswerRe: Data Grid Table Style Allowsorting property Pin
Vipin Venugopal31-Jul-06 23:49
Vipin Venugopal31-Jul-06 23:49 
GeneralRe: Data Grid Table Style Allowsorting property Pin
indiaone1-Aug-06 0:29
indiaone1-Aug-06 0:29 
QuestionDate Time Synchronize Pin
Rahul.RK31-Jul-06 23:20
Rahul.RK31-Jul-06 23:20 
AnswerRe: Date Time Synchronize Pin
stancrm31-Jul-06 23:28
stancrm31-Jul-06 23:28 
AnswerRe: Date Time Synchronize Pin
J4amieC1-Aug-06 0:03
J4amieC1-Aug-06 0:03 

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.