Skip to content

Commit

Permalink
Merge pull request #12150 from Lehonti/master
Browse files Browse the repository at this point in the history
Changed null checks to make use of nameof()
  • Loading branch information
maxkatz6 committed Jul 12, 2023
2 parents 54158b4 + ddfe89f commit b173419
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/Avalonia.Base/Threading/Dispatcher.Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void Invoke(Action callback, DispatcherPriority priority, CancellationTok
{
if (callback == null)
{
throw new ArgumentNullException("callback");
throw new ArgumentNullException(nameof(callback));
}

DispatcherPriority.Validate(priority, "priority");
Expand Down Expand Up @@ -212,7 +212,7 @@ public TResult Invoke<TResult>(Func<TResult> callback, DispatcherPriority priori
{
if (callback == null)
{
throw new ArgumentNullException("callback");
throw new ArgumentNullException(nameof(callback));
}

DispatcherPriority.Validate(priority, "priority");
Expand Down Expand Up @@ -304,7 +304,7 @@ public DispatcherOperation InvokeAsync(Action callback, DispatcherPriority prior
{
if (callback == null)
{
throw new ArgumentNullException("callback");
throw new ArgumentNullException(nameof(callback));
}

DispatcherPriority.Validate(priority, "priority");
Expand Down Expand Up @@ -379,7 +379,7 @@ public DispatcherOperation<TResult> InvokeAsync<TResult>(Func<TResult> callback,
{
if (callback == null)
{
throw new ArgumentNullException("callback");
throw new ArgumentNullException(nameof(callback));
}

DispatcherPriority.Validate(priority, "priority");
Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.Base/Threading/DispatcherTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public DispatcherTimer(TimeSpan interval, DispatcherPriority priority, EventHand
{
if (callback == null)
{
throw new ArgumentNullException("callback");
throw new ArgumentNullException(nameof(callback));
}

Tick += callback;
Expand Down Expand Up @@ -253,7 +253,7 @@ internal DispatcherTimer(Dispatcher dispatcher, DispatcherPriority priority, Tim
{
if (dispatcher == null)
{
throw new ArgumentNullException("dispatcher");
throw new ArgumentNullException(nameof(dispatcher));
}

DispatcherPriority.Validate(priority, "priority");
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected internal override void RefreshCellContent(Control element, string prop
{
if (element == null)
{
throw new ArgumentNullException("element");
throw new ArgumentNullException(nameof(element));
}
if (element is CheckBox checkBox)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Controls.DataGrid/DataGridColumnCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected override void InsertItem(int columnIndex, DataGridColumn dataGridColum
}
if (dataGridColumn == null)
{
throw new ArgumentNullException("dataGridColumn");
throw new ArgumentNullException(nameof(dataGridColumn));
}

int columnIndexWithFiller = columnIndex;
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Controls.DataGrid/DataGridLength.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
{
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
throw new ArgumentNullException(nameof(destinationType));
}
if (destinationType != typeof(string))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ControlAutomationPeer : AutomationPeer

public ControlAutomationPeer(Control owner)
{
Owner = owner ?? throw new ArgumentNullException("owner");
Owner = owner ?? throw new ArgumentNullException(nameof(owner));
Initialize();
}

Expand Down

0 comments on commit b173419

Please sign in to comment.