Why should I use InitializeLifetimeService in WinForm dialog?

I am refactoring code inherited from a long gone developer and found this:

ImportExportForm l_Form = new ImportExportForm();
l_Form.InitializeLifetimeService();
l_Form.ShowDialog();

      

I have never seen or used a LifetimeService before, but from the small number I read, I don’t understand why I would like to use it here, but before speaking WTF I wondered if I could skip some subtle details?

0


source to share


2 answers


As far as I know, this is the method that is commonly used for remote .NET objects and for setting the lifetime of an instance. See here:

http://msdn.microsoft.com/es-es/magazine/cc300474(en-us).aspx



I don't think this is important for a regular Windows Form.

+3


source


True, it is used for .Net remote access like WCF. Except when your ImportExportForm object is loading something remotely, I see no reason to use that. See There: http://msdn.microsoft.com/en-us/library/23bk23zc(v=vs.100).aspx



+1


source







All Articles