SessionChangeDescription.SessionId 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得相關聯工作階段的工作階段識別碼。
public:
property int SessionId { int get(); };
public int SessionId { get; }
member this.SessionId : int
Public ReadOnly Property SessionId As Integer
屬性值
相關聯工作階段的工作階段識別碼。
範例
下列程式碼範例示範在 SessionId 衍生自 ServiceBase 的 OnSessionChange 類別中,方法的實作中使用 屬性。 此程式碼範例是針對 類別提供的較大範例的 ServiceBase 一部分。
// Handle a session change notice
protected override void OnSessionChange(SessionChangeDescription changeDescription)
{
#if LOGEVENTS
EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() +
" - Session change notice received: " +
changeDescription.Reason.ToString() + " Session ID: " +
changeDescription.SessionId.ToString());
#endif
' Handle a session change notice
Protected Overrides Sub OnSessionChange(ByVal changeDescription As SessionChangeDescription)
#If LOGEVENTS Then
System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " - Session change notice received: " + changeDescription.Reason.ToString() + " Session ID: " + changeDescription.SessionId.ToString())
#End If
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應