BufferManager 類別

定義

許多 Windows Communication Foundation (WCF) 功能都需要使用緩衝區,但是反覆建立與終結緩衝區是相當費時的工作。Many Windows Communication Foundation (WCF) features require the use of buffers, which are expensive to create and destroy. 您可以使用 BufferManager 類別管理緩衝區集區。You can use the BufferManager class to manage a buffer pool. 當您產生這個類別時會建立集區與其緩衝區,而當記憶體回收要收回緩衝區集區時就會加以終結。The pool and its buffers are created when you instantiate this class and destroyed when the buffer pool is reclaimed by garbage collection. 當您每次需要使用緩衝區時,就從集區取用一個,使用完畢後再交還給集區。Every time you need to use a buffer, you take one from the pool, use it, and return it to the pool when done. 這個程序比每次需要使用時才建立與終結緩衝區要快得多。This process is much faster than creating and destroying a buffer every time you need to use one.

public ref class BufferManager abstract
public abstract class BufferManager
type BufferManager = class
Public MustInherit Class BufferManager
繼承
BufferManager

備註

實作自訂編碼器或自訂傳輸通道時,通常會使用這個類別。This class is commonly used while implementing custom encoders or custom transport channels.

建構函式

BufferManager()

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

方法

Clear()

釋放目前快取在管理員中的緩衝區。Releases the buffers currently cached in the manager.

CreateBufferManager(Int64, Int32)

使用指定的緩衝區集區大小上限,以及集區中個別緩衝區的大小上限建立新的 BufferManager。Creates a new BufferManager with a specified maximum buffer pool size and a maximum size for each individual buffer in the pool.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ReturnBuffer(Byte[])

將緩衝區傳回集區。Returns a buffer to the pool.

TakeBuffer(Int32)

從集區取得最少為指定大小的緩衝區。Gets a buffer of at least the specified size from the pool.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於