ServicePoint.IdleSince 屬性

定義

取得 ServicePoint 物件上次連接至主機的日期和時間。

public:
 property DateTime IdleSince { DateTime get(); };
public DateTime IdleSince { get; }
member this.IdleSince : DateTime
Public ReadOnly Property IdleSince As DateTime

屬性值

DateTime 物件,包含上次連接 ServicePoint 物件的日期和時間。

範例

下列程式代碼範例會 IdleSince 使用 屬性來設定及擷取物件上次連接到主機的 ServicePoint 日期和時間。

// Display the date and time that the ServicePoint was last 
// connected to a host.
Console::WriteLine( "IdleSince = {0}", sp->IdleSince );

// Display the maximum length of time that the ServicePoint instance  
// is allowed to maintain an idle connection to an Internet  
// resource before it is recycled for use in another connection.
Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime );
// Display the date and time that the ServicePoint was last
// connected to a host.
Console.WriteLine("IdleSince = " + sp.IdleSince.ToString());

// Display the maximum length of time that the ServicePoint instance
// is allowed to maintain an idle connection to an Internet
// resource before it is recycled for use in another connection.
Console.WriteLine("MaxIdleTime = " + sp.MaxIdleTime);
' Display the date and time that the ServicePoint was last 
' connected to a host.
Console.WriteLine(("IdleSince = " + sp.IdleSince.ToString()))


' Display the maximum length of time that the ServicePoint instance 
' is allowed to maintain an idle connection to an Internet  
' resource before it is recycled for use in another connection.
Console.WriteLine(("MaxIdleTime = " + sp.MaxIdleTime.ToString()))

備註

屬性 IdleSince 會記錄服務點與主機中斷連線的最後日期和時間。 當目前時間 IdleSince 與之間的差異超過 的值 MaxIdleTime時, ServicePoint 物件可用於回收至另一個連接。

適用於