Browse Source

Changed null checks to make use of nameof()

pull/12150/head
john_doe 3 years ago
parent
commit
bd64a51eeb
  1. 8
      src/Avalonia.Base/Threading/Dispatcher.Invoke.cs
  2. 4
      src/Avalonia.Base/Threading/DispatcherTimer.cs
  3. 2
      src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
  4. 2
      src/Avalonia.Controls.DataGrid/DataGridColumnCollection.cs
  5. 2
      src/Avalonia.Controls.DataGrid/DataGridLength.cs
  6. 2
      src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs

8
src/Avalonia.Base/Threading/Dispatcher.Invoke.cs

@ -90,7 +90,7 @@ public partial class Dispatcher
{ {
if (callback == null) if (callback == null)
{ {
throw new ArgumentNullException("callback"); throw new ArgumentNullException(nameof(callback));
} }
DispatcherPriority.Validate(priority, "priority"); DispatcherPriority.Validate(priority, "priority");
@ -212,7 +212,7 @@ public partial class Dispatcher
{ {
if (callback == null) if (callback == null)
{ {
throw new ArgumentNullException("callback"); throw new ArgumentNullException(nameof(callback));
} }
DispatcherPriority.Validate(priority, "priority"); DispatcherPriority.Validate(priority, "priority");
@ -304,7 +304,7 @@ public partial class Dispatcher
{ {
if (callback == null) if (callback == null)
{ {
throw new ArgumentNullException("callback"); throw new ArgumentNullException(nameof(callback));
} }
DispatcherPriority.Validate(priority, "priority"); DispatcherPriority.Validate(priority, "priority");
@ -379,7 +379,7 @@ public partial class Dispatcher
{ {
if (callback == null) if (callback == null)
{ {
throw new ArgumentNullException("callback"); throw new ArgumentNullException(nameof(callback));
} }
DispatcherPriority.Validate(priority, "priority"); DispatcherPriority.Validate(priority, "priority");

4
src/Avalonia.Base/Threading/DispatcherTimer.cs

@ -62,7 +62,7 @@ public partial class DispatcherTimer
{ {
if (callback == null) if (callback == null)
{ {
throw new ArgumentNullException("callback"); throw new ArgumentNullException(nameof(callback));
} }
Tick += callback; Tick += callback;
@ -253,7 +253,7 @@ public partial class DispatcherTimer
{ {
if (dispatcher == null) if (dispatcher == null)
{ {
throw new ArgumentNullException("dispatcher"); throw new ArgumentNullException(nameof(dispatcher));
} }
DispatcherPriority.Validate(priority, "priority"); DispatcherPriority.Validate(priority, "priority");

2
src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs

@ -222,7 +222,7 @@ namespace Avalonia.Controls
{ {
if (element == null) if (element == null)
{ {
throw new ArgumentNullException("element"); throw new ArgumentNullException(nameof(element));
} }
if (element is CheckBox checkBox) if (element is CheckBox checkBox)
{ {

2
src/Avalonia.Controls.DataGrid/DataGridColumnCollection.cs

@ -191,7 +191,7 @@ namespace Avalonia.Controls
} }
if (dataGridColumn == null) if (dataGridColumn == null)
{ {
throw new ArgumentNullException("dataGridColumn"); throw new ArgumentNullException(nameof(dataGridColumn));
} }
int columnIndexWithFiller = columnIndex; int columnIndexWithFiller = columnIndex;

2
src/Avalonia.Controls.DataGrid/DataGridLength.cs

@ -499,7 +499,7 @@ namespace Avalonia.Controls
{ {
if (destinationType == null) if (destinationType == null)
{ {
throw new ArgumentNullException("destinationType"); throw new ArgumentNullException(nameof(destinationType));
} }
if (destinationType != typeof(string)) if (destinationType != typeof(string))
{ {

2
src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs

@ -18,7 +18,7 @@ namespace Avalonia.Automation.Peers
public ControlAutomationPeer(Control owner) public ControlAutomationPeer(Control owner)
{ {
Owner = owner ?? throw new ArgumentNullException("owner"); Owner = owner ?? throw new ArgumentNullException(nameof(owner));
Initialize(); Initialize();
} }

Loading…
Cancel
Save