aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Common
diff options
context:
space:
mode:
authorBerkan Diler <berkan.diler1@ingka.ikea.com>2022-12-27 20:27:11 +0100
committerGitHub <noreply@github.com>2022-12-27 20:27:11 +0100
commit0d3b82477ecbf7128340b6725a79413427c68748 (patch)
tree2d62c68e38a3c4c79ef7cc1d92700617a40e70ca /ARMeilleure/Common
parent470be03c2ff22346a1f0ae53fa25f53c4d1790b5 (diff)
Use new ArgumentNullException and ObjectDisposedException throw-helper API (#4163)
Diffstat (limited to 'ARMeilleure/Common')
-rw-r--r--ARMeilleure/Common/AddressTable.cs15
-rw-r--r--ARMeilleure/Common/Counter.cs5
-rw-r--r--ARMeilleure/Common/EntryTable.cs15
3 files changed, 7 insertions, 28 deletions
diff --git a/ARMeilleure/Common/AddressTable.cs b/ARMeilleure/Common/AddressTable.cs
index 7cb83fdd..9db2d00d 100644
--- a/ARMeilleure/Common/AddressTable.cs
+++ b/ARMeilleure/Common/AddressTable.cs
@@ -80,10 +80,7 @@ namespace ARMeilleure.Common
{
get
{
- if (_disposed)
- {
- throw new ObjectDisposedException(null);
- }
+ ObjectDisposedException.ThrowIf(_disposed, this);
lock (_pages)
{
@@ -100,10 +97,7 @@ namespace ARMeilleure.Common
/// <exception cref="ArgumentException">Length of <paramref name="levels"/> is less than 2</exception>
public AddressTable(Level[] levels)
{
- if (levels == null)
- {
- throw new ArgumentNullException(nameof(levels));
- }
+ ArgumentNullException.ThrowIfNull(levels);
if (levels.Length < 2)
{
@@ -141,10 +135,7 @@ namespace ARMeilleure.Common
/// <exception cref="ArgumentException"><paramref name="address"/> is not mapped</exception>
public ref TEntry GetValue(ulong address)
{
- if (_disposed)
- {
- throw new ObjectDisposedException(null);
- }
+ ObjectDisposedException.ThrowIf(_disposed, this);
if (!IsValid(address))
{
diff --git a/ARMeilleure/Common/Counter.cs b/ARMeilleure/Common/Counter.cs
index 4b0627c1..d7210d15 100644
--- a/ARMeilleure/Common/Counter.cs
+++ b/ARMeilleure/Common/Counter.cs
@@ -49,10 +49,7 @@ namespace ARMeilleure.Common
{
get
{
- if (_disposed)
- {
- throw new ObjectDisposedException(null);
- }
+ ObjectDisposedException.ThrowIf(_disposed, this);
return ref _countTable.GetValue(_index);
}
diff --git a/ARMeilleure/Common/EntryTable.cs b/ARMeilleure/Common/EntryTable.cs
index f3f3ce28..6f205797 100644
--- a/ARMeilleure/Common/EntryTable.cs
+++ b/ARMeilleure/Common/EntryTable.cs
@@ -53,10 +53,7 @@ namespace ARMeilleure.Common
/// <exception cref="ObjectDisposedException"><see cref="EntryTable{TEntry}"/> instance was disposed</exception>
public int Allocate()
{
- if (_disposed)
- {
- throw new ObjectDisposedException(null);
- }
+ ObjectDisposedException.ThrowIf(_disposed, this);
lock (_allocated)
{
@@ -83,10 +80,7 @@ namespace ARMeilleure.Common
/// <exception cref="ObjectDisposedException"><see cref="EntryTable{TEntry}"/> instance was disposed</exception>
public void Free(int index)
{
- if (_disposed)
- {
- throw new ObjectDisposedException(null);
- }
+ ObjectDisposedException.ThrowIf(_disposed, this);
lock (_allocated)
{
@@ -108,10 +102,7 @@ namespace ARMeilleure.Common
/// <exception cref="ArgumentException">Entry at <paramref name="index"/> is not allocated</exception>
public ref TEntry GetValue(int index)
{
- if (_disposed)
- {
- throw new ObjectDisposedException(null);
- }
+ ObjectDisposedException.ThrowIf(_disposed, this);
lock (_allocated)
{