[Idea] `Using` with PooledObjects
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
## `Using` with PooledObjects to free.
When using an `ObjectPool` it is important to release the `PooledObject` back to the pool, otherwise memory leaks can happen. We could help prevent this by allow automatically releasing the object back.
I propose that we extend the `using block` syntax.
**`Using`** *`variable`* **`From`** *`ObjectPool`* `...` **`End Using`**
__Usage__
```vbnet
Using _PooledObject From ObjectPool
' ...
End Using
```
It would be **Roughly** equivalent to
```vbnet
Dim _PooledObject As PooledObject(Of T)
Try
_PooledObject = ObjectPool.Aquire()
' ...
Catch ex As EmpyObjectPool_Exception
' ...
Finally
If _PooledObject IsNot Nothing Then
_PooledObject.ReleaseBackToPool( ObjectPool )
End If
End Try
```
We would need to workout if there is a common pattern / interface use by Pooled Objects and Object Pools first.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.