ISponsor.Renewal Method (ILease)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Requests a sponsoring client to renew the lease for the specified object.

Namespace:   System.Runtime.Remoting.Lifetime
Assembly:  mscorlib (in mscorlib.dll)

TimeSpan Renewal(
	ILease lease


Type: System.Runtime.Remoting.Lifetime.ILease

The lifetime lease of the object that requires lease renewal.

Return Value

Type: System.TimeSpan

The additional lease time for the specified object.

Exception Condition

The immediate caller makes the call through a reference to the interface and does not have infrastructure permission.

The Renewal method is called by the distributed garbage collector to renew the lease for the specified object.

public class MyClientSponsor : MarshalByRefObject, ISponsor
   private DateTime lastRenewal;
   public MyClientSponsor()
      lastRenewal = DateTime.Now;

   [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.Infrastructure)]
   public TimeSpan Renewal(ILease lease)
      Console.WriteLine("Request to renew the lease time.");
      Console.WriteLine("Time since last renewal: " + 
         (DateTime.Now - lastRenewal).ToString());

      lastRenewal = DateTime.Now;
      return TimeSpan.FromSeconds(20);


for operating with infrastructure code. Demand value: SecurityAction.LinkDemand; Permission value: SecurityPermissionFlag.Infrastructure

.NET Framework
Available since 1.1
Return to top