ReliableSession ReliableSession ReliableSession ReliableSession Class


提供对可靠会话绑定元素属性的便捷访问,这些属性是在使用系统提供的绑定之一时提供的。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


下面的代码演示如何创建新的可靠会话,以及访问和更改该会话的属性值。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() ReliableSession() ReliableSession()

初始化 ReliableSession 类的新实例。Initializes a new instance of the ReliableSession class.

ReliableSession(ReliableSessionBindingElement) ReliableSession(ReliableSessionBindingElement) ReliableSession(ReliableSessionBindingElement) ReliableSession(ReliableSessionBindingElement)

从可靠会话绑定元素中初始化 ReliableSession 类的新实例。Initializes a new instance of the ReliableSession class from a reliable session binding element.


InactivityTimeout InactivityTimeout InactivityTimeout InactivityTimeout

获取或设置服务在关闭之前保持非活动状态的时间间隔。Gets or sets an interval of time that a service can remain inactive before closing.

Ordered Ordered Ordered Ordered

获取或设置一个值,该值指示消息传递是否必须保持与消息发送一致的顺序。Gets or sets a value that indicates whether message delivery must preserve the order in which messages are sent.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)