[FR] CompositeDisposable - Remove accepts null values and returns false instead of throwing ArgumentNullException
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
#### Feature request
> Which next library version (i.e., patch, minor or major)?
- 16.2.0.0
> What are the platform(s), environment(s) and related component version(s)?
- Windows 10
> How commonly is this feature needed (one project, several projects, company-wide, global)?
- company-wide
> Please describe the feature.
The "Remove" method in the "CompositeDisposable" class accepts an IDispoable and returns a bool representing the success/failure of the operation.
If the parameter is null an ArgumentNullException is thrown. It would be better to return the value false instead of throwing an Exception.
If this is not possible, please add a "TryRemove" method that does not throw.
I would like to inherit the class and override the remove method, but the class is sealed and i do not want to maintain a branch just for this change.
something like:
```
///
/// Removes and disposes the first occurrence of a disposable from the .
///
/// Disposable to remove.
/// true if found; false otherwise.
/// is null.
public bool Remove(IDisposable item)
{
if (item == null)
{
return false;
}
lock (_gate)
[...]
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.