SqlBulkCopy.IDisposable.Dispose Method

Definition

釋放目前的 SqlBulkCopy 類別執行個體所使用的所有資源。Releases all resources used by the current instance of the SqlBulkCopy class.

 virtual void System.IDisposable.Dispose() = IDisposable::Dispose;
void IDisposable.Dispose ();
abstract member System.IDisposable.Dispose : unit -> unit
override this.System.IDisposable.Dispose : unit -> unit
Sub Dispose () Implements IDisposable.Dispose

Implements

Remarks

Dispose 使用完畢時,請呼叫 SqlBulkCopyCall Dispose when you are finished using the SqlBulkCopy. Dispose 方法會將 SqlBulkCopy 保留在無法使用的狀態。The Dispose method leaves the SqlBulkCopy in an unusable state. 呼叫 Dispose之後,您必須釋放所有對 SqlBulkCopy 的參考,讓垃圾收集行程可以回收 SqlBulkCopy 所佔用的記憶體。After calling Dispose, you must release all references to the SqlBulkCopy so the garbage collector can reclaim the memory that the SqlBulkCopy was occupying.

如需詳細資訊,請參閱清除非受控資源執行 Dispose 方法For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

Note

在您釋放最後一個 Dispose 參考之前,請務必呼叫 SqlBulkCopyAlways call Dispose before you release your last reference to the SqlBulkCopy. 否則工作窗格所使用的資源不會釋放,直到記憶體回收行程呼叫 SqlBulkCopy 物件的 Finalize 方法。Otherwise, the resources it is using will not be freed until the garbage collector calls the SqlBulkCopy object's Finalize method.

Applies to

See also