Share via


SessionChangeDescription.SessionId Özellik

Tanım

İlişkili oturumun oturum kimliğini alır.

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

Özellik Değeri

İlişkili oturumun oturum kimliği.

Örnekler

Aşağıdaki kod örneği, öğesinden ServiceBasetüretilen bir sınıfta yönteminin OnSessionChange uygulamasında özelliğinin kullanımını SessionId gösterir. Bu kod örneği, sınıfı için ServiceBase sağlanan daha büyük bir örneğin parçasıdır.

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

Şunlara uygulanır