1

I'm refactoring some code I inherited from a long-gone developer, and I find this:

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

I've never seen or used the LifetimeService before, but from the little I've read, I don't understand why I would want to use it here, but before saying WTF, I wondered if I might be missing some subtle detail?

Benjol
  • 63,995
  • 54
  • 186
  • 268

2 Answers2

4

As far as I know this is a method normally use for Remote .Net Objects, and to establish the lifetime of an instance. Look here:

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

I don't think that it's important for normal Windows Form.

netadictos
  • 7,602
  • 2
  • 42
  • 69
  • I don't know enough about the subject to know if this IS the right answer, but being as SO keeps nagging me to mark answered questions.... I'll give this one the benefit of the doubt. – Benjol Feb 16 '09 at 21:11
  • The link no longer works - according to https://stackoverflow.com/a/25315226/155892 it was in the *December 2003* issue though which can be downloaded in CHM format from the same page. – Mark Sowul Sep 09 '18 at 20:25
1

True, it is used for .Net remoting, like WCF. Except if your object ImportExportForm is loading something remotely, i don't see any reason to use this. See there: http://msdn.microsoft.com/en-us/library/23bk23zc(v=vs.100).aspx

ssl46
  • 11
  • 2