Click here to Skip to main content
15,929,596 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataSet Relations Pin
xoph21-Aug-03 1:52
xoph21-Aug-03 1:52 
GeneralRe: DataSet Relations Pin
totig21-Aug-03 2:29
totig21-Aug-03 2:29 
GeneralRe: DataSet Relations Pin
xoph23-Aug-03 0:23
xoph23-Aug-03 0:23 
GeneralRe: DataSet Relations Pin
xfqiu21-Aug-03 21:35
xfqiu21-Aug-03 21:35 
GeneralA Question about Remoting Pin
Mazdak20-Aug-03 23:49
Mazdak20-Aug-03 23:49 
GeneralRe: A Question about Remoting Pin
shaunAustin21-Aug-03 3:09
shaunAustin21-Aug-03 3:09 
GeneralRe: A Question about Remoting Pin
Mazdak21-Aug-03 20:38
Mazdak21-Aug-03 20:38 
GeneralRe: A Question about Remoting Pin
Mazdak21-Aug-03 21:30
Mazdak21-Aug-03 21:30 
GeneralRe: A Question about Remoting Pin
shaunAustin21-Aug-03 22:04
shaunAustin21-Aug-03 22:04 
GeneralI know it's a silly thing, but this is giving me hassle... Pin
The_Preacher20-Aug-03 23:04
The_Preacher20-Aug-03 23:04 
GeneralRe: I know it's a silly thing, but this is giving me hassle... Pin
MeisterBiber21-Aug-03 4:06
MeisterBiber21-Aug-03 4:06 
GeneralRe: I know it's a silly thing, but this is giving me hassle... Pin
Alvaro Mendez21-Aug-03 11:11
Alvaro Mendez21-Aug-03 11:11 
GeneralAsynchronous Delegates Pin
Ryan Binns20-Aug-03 17:18
Ryan Binns20-Aug-03 17:18 
GeneralRe: Asynchronous Delegates Pin
J. Dunlap20-Aug-03 18:06
J. Dunlap20-Aug-03 18:06 
GeneralRe: Asynchronous Delegates Pin
Ryan Binns20-Aug-03 18:14
Ryan Binns20-Aug-03 18:14 
GeneralRe: Asynchronous Delegates Pin
J. Dunlap20-Aug-03 18:19
J. Dunlap20-Aug-03 18:19 
GeneralRe: Asynchronous Delegates Pin
Ryan Binns20-Aug-03 18:57
Ryan Binns20-Aug-03 18:57 
GeneralRe: Asynchronous Delegates Pin
J. Dunlap20-Aug-03 19:05
J. Dunlap20-Aug-03 19:05 
GeneralTracking Object Creation of Remotable Object Pin
Ozyris20-Aug-03 15:40
Ozyris20-Aug-03 15:40 
GeneralRe: Tracking Object Creation of Remotable Object Pin
Okeno Palmer21-Aug-03 6:57
Okeno Palmer21-Aug-03 6:57 
I don't know much about remoting but the idea of a singelton is that there will only be one instance of it during the lifetime of the application. This is usually accomplished by making the varaible a static. Note that there will really only ever be just 1 instance of your Singleton if that is the case.

One approach is to have a static tracker that is incremented in the constructor of your Singleton class and decremented in the destructor.

Ex:

class SingleFella
{
private static int tracker = 0;
private static SingleFella m_instance = null;

public static SingleFella GetInstance()
{
if( m_instance == null )
m_instance = new SingleFella();
return m_instance;
}

public static void DestroyInstance()
{
m_instance = null;
}

private SingleFella()
{
tracker++;
System.Console.WriteLine("Tracker (Constructor)= " + tracker);
}

~SingleFella()
{
tracker--;
m_instance = null;
System.Console.WriteLine("Tracker (Destructor)= " + tracker);
}

public static void Main(String [] args)
{
SingleFella instance1 = SingleFella.GetInstance();
SingleFella instance2 = SingleFella.GetInstance();
SingleFella instance3 = SingleFella.GetInstance();
SingleFella instance4 = SingleFella.GetInstance();
SingleFella.DestroyInstance();
}
}

Give that sample a run and move around the call to DestroyInstance() and you will see the effect.

I'm not quite sure if this is what you are looking for but this is how the Singleton Design Pattern works.

..:: Keno ::..
QuestionHow to make DataGrid column read only at runtime Pin
sumeat20-Aug-03 14:58
sumeat20-Aug-03 14:58 
AnswerRe: How to make DataGrid column read only at runtime Pin
Ista20-Aug-03 16:10
Ista20-Aug-03 16:10 
GeneralRe: How to make DataGrid column read only at runtime Pin
sumeat21-Aug-03 7:59
sumeat21-Aug-03 7:59 
GeneralRe: How to make DataGrid column read only at runtime Pin
Ista21-Aug-03 9:43
Ista21-Aug-03 9:43 
AnswerRe: How to make DataGrid column read only at runtime Pin
A.Wegierski21-Aug-03 7:48
A.Wegierski21-Aug-03 7:48 

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.