Click or drag to resize

JCOBridgeDisposeAsyncScope Constructor

Initializes a new batch dispose scope for async contexts. Disposal of JVM objects within this scope is batched and flushed in a single native call when the scope exits. The scope state flows automatically across await continuations.

Namespace: MASES.JCOBridge.C2JBridge
Assembly: C2JBridge (in C2JBridge.dll) Version: 2.6.10.261112-5ffe0920c00dbac056780af7ab9b1978b26ef4a5
Syntax
public JCOBridgeDisposeAsyncScope(
	int maxPerBatch = 64
)

Parameters

maxPerBatch  Int32  (Optional)
Maximum number of JVM references to queue before an automatic flush is triggered. Defaults to 64.
Example
C#
await using var scope = new JCOBridgeDisposeAsyncScope();
await foreach (var item in asyncCollection)
{
    using (item) { /* item disposal is batched */ }
}
See Also