This documentation is archived and is not being maintained.

ILease.CurrentLeaseTime Property

Gets the amount of time remaining on the lease.

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

TimeSpan CurrentLeaseTime { get; }
/** @property */
TimeSpan get_CurrentLeaseTime ()

function get CurrentLeaseTime () : TimeSpan

Property Value

The amount of time remaining on the lease.

Exception typeCondition


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

The following example uses RemotingServices.GetLifetimeService to obtain an object that implements the ILease interface. To compile and run this example, you need the complete client, server, and shared library code found in the example for ILease.

// Register the channel.
TcpChannel myChannel = new TcpChannel ();

TimeSpan myTimeSpan = TimeSpan.FromMinutes(10);

// Create a remote object.
HelloService myService = new HelloService();

ILease myLease;
myLease = (ILease)RemotingServices.GetLifetimeService(myService);
if (myLease == null)
   Console.WriteLine("Cannot lease.");

Console.WriteLine ("Initial lease time is " + myLease.InitialLeaseTime);
Console.WriteLine ("Current lease time is " + myLease.CurrentLeaseTime);
Console.WriteLine ("Renew on call time is " + myLease.RenewOnCallTime);
Console.WriteLine ("Sponsorship timeout is " + myLease.SponsorshipTimeout);
Console.WriteLine ("Current lease state is " + myLease.CurrentState.ToString());

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0