Nyelv

SessionChangeDescription.SessionId Tulajdonság

Definíció

Lekéri a társított munkamenet munkamenet-azonosítóját.

public:
 property int SessionId { int get(); };
public int SessionId { get; }
member this.SessionId : int
Public ReadOnly Property SessionId As Integer

Tulajdonság értéke

A társított munkamenet munkamenet-azonosítója.

Példák

Az alábbi példakód a tulajdonság használatát mutatja be a SessionId metódus implementációjában egy, a OnSessionChange forrásból ServiceBaseszármaztatott osztályban. Ez a példakód egy nagyobb, az ServiceBase osztályhoz tartozó példa része.

        // 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

A következőre érvényes: