ReliableSession 類別

定義

提供方便存取可靠工作階段繫結項目的屬性,只要使用任一系統提供的繫結即可應用此項目。Provides convenient access to the properties of a reliable session binding element that are available when using one of the system-provided bindings.

public ref class ReliableSession
public class ReliableSession
type ReliableSession = class
Public Class ReliableSession
繼承
ReliableSession
衍生

範例

下列範例示範如何建立新的可靠工作階段,然後存取並變更該工作階段的屬性值。The following example shows how to create a new reliable session, and access and change the property values of that session. ReliableSession 類別允許您寫下:The ReliableSession class allows you to write:

// Create a new reliable session object
ReliableSessionBindingElement bindingElement = new ReliableSessionBindingElement();
ReliableSession reliableSession = new ReliableSession(bindingElement);

// Now you can access property values
Console.WriteLine("Ordered: {0}", reliableSession.Ordered);
Console.WriteLine("InactivityTimeout: {0}", reliableSession.InactivityTimeout);
reliableSession.Ordered = false;
Console.WriteLine("The new value for the Ordered property is: {0}", reliableSession.Ordered);
' Create a new reliable session object
Dim bindingElement As ReliableSessionBindingElement = New ReliableSessionBindingElement()
Dim reliableSession As ReliableSession = New ReliableSession(bindingElement)

' Now you can access property values
Console.WriteLine("Ordered: {0}", reliableSession.Ordered)
Console.WriteLine("InactivityTimeout: {0}", reliableSession.InactivityTimeout)
ReliableSession.Ordered = False
Console.WriteLine("The new value for the Ordered property is: {0}", ReliableSession.Ordered)

備註

ReliableSession 類別包含的屬性為 ReliableSessionBindingElement 所包含的那些屬性之子集合,後者可從預先定義之繫結存取。The properties contained in the ReliableSession class are the subset of those contained in the ReliableSessionBindingElement that are accessible from a predefined binding. 此子集合包含 InactivityTimeoutOrdered 屬性。This subset consists of the InactivityTimeout and Ordered properties. ReliableSession 類別與 ReliableSessionBindingElement 參考相同物件,因此改變其中一個的值,就會改變另一個的值。The ReliableSession class references the same objects as does the ReliableSessionBindingElement, so changing the value of one changes the value of the other too. 此類別一併蒐集這兩個可靠工作階段繫結項目,以實現更佳的可探索性。This class gathers these two properties of reliable session binding element together for better discoverability.

建構函式

ReliableSession()

初始化 ReliableSession 類別的新執行個體。Initializes a new instance of the ReliableSession class.

ReliableSession(ReliableSessionBindingElement)

從可靠工作階段繫結項目,初始化 ReliableSession 類別的新執行個體。Initializes a new instance of the ReliableSession class from a reliable session binding element.

屬性

InactivityTimeout

取得或設定服務在關閉之前維持在非作用狀態的時間間隔。Gets or sets an interval of time that a service can remain inactive before closing.

Ordered

取得或設定值,這個值會指出訊息傳遞是否必須保留訊息傳送時的順序。Gets or sets a value that indicates whether message delivery must preserve the order in which messages are sent.

方法

Equals(Object)

Determines whether the specified object is equal to the current object.Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

Serves as the default hash function.Serves as the default hash function.

(繼承來源 Object)
GetType()

Gets the Type of the current instance.Gets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

Creates a shallow copy of the current Object.Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

Returns a string that represents the current object.Returns a string that represents the current object.

(繼承來源 Object)

適用於