Monday, February 21, 2011

Why does MarshalByRefObject.InitializeLifetimeService return an object and not an ILease?

I am reading through the msdn docs for .NET Remoting and noticed that the MarshalByRefObject.InitializeLifetimeService method returns an object instead of an ILease. The documentation says that the method returns an object of type ILease and all code examples I have found casts the returned value to an ILease. But the methods signature says that it returns an object. Does anybody know why?

I'm just curious... :-)

From stackoverflow
  • Odd. Reflector shows that all the method does is:

    return LifetimeServices.GetLeaseInitial(this);
    

    which does return an ILease. So it's probably just an oversight in the library (that has to be propogated forward for compatibility issues), especially if the documentation also claims it's an ILease

0 comments:

Post a Comment