mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-20 06:47:56 +08:00
Switching to ObjectDisposedException.ThrowIf
This commit is contained in:
parent
575e49f70c
commit
27f4f56d2d
@ -220,9 +220,6 @@ public class WrappingStream : Stream
|
|||||||
private void ThrowIfDisposed()
|
private void ThrowIfDisposed()
|
||||||
{
|
{
|
||||||
// throws an ObjectDisposedException if this object has been disposed
|
// throws an ObjectDisposedException if this object has been disposed
|
||||||
if (_streamBase == null)
|
ObjectDisposedException.ThrowIf(_streamBase == null, this);
|
||||||
{
|
|
||||||
throw new ObjectDisposedException(GetType().Name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,10 +240,7 @@ namespace Common.Utilities
|
|||||||
|
|
||||||
private void CheckDisposed()
|
private void CheckDisposed()
|
||||||
{
|
{
|
||||||
if (_stream == null)
|
ObjectDisposedException.ThrowIf(_stream == null, this);
|
||||||
{
|
|
||||||
throw new ObjectDisposedException(nameof(ReadonlyStream));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user