diff --git a/src/Avalonia.Animation/IterationCount.cs b/src/Avalonia.Animation/IterationCount.cs index eafc483868..e9cd0686d8 100644 --- a/src/Avalonia.Animation/IterationCount.cs +++ b/src/Avalonia.Animation/IterationCount.cs @@ -44,7 +44,7 @@ namespace Avalonia.Animation { if (type > IterationType.Infinite) { - throw new ArgumentException("Invalid value", "type"); + throw new ArgumentException("Invalid value", nameof(type)); } _type = type; diff --git a/src/Avalonia.Base/Collections/AvaloniaDictionary.cs b/src/Avalonia.Base/Collections/AvaloniaDictionary.cs index e8dc2a5ed7..4de4c540a0 100644 --- a/src/Avalonia.Base/Collections/AvaloniaDictionary.cs +++ b/src/Avalonia.Base/Collections/AvaloniaDictionary.cs @@ -148,7 +148,7 @@ namespace Avalonia.Collections { if (_inner.TryGetValue(key, out TValue value)) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count")); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Count))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs($"Item[{key}]")); if (CollectionChanged != null) @@ -209,7 +209,7 @@ namespace Avalonia.Collections private void NotifyAdd(TKey key, TValue value) { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count")); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Count))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs($"Item[{key}]")); diff --git a/src/Avalonia.Base/Collections/AvaloniaList.cs b/src/Avalonia.Base/Collections/AvaloniaList.cs index d5a4e63003..4d4a561b08 100644 --- a/src/Avalonia.Base/Collections/AvaloniaList.cs +++ b/src/Avalonia.Base/Collections/AvaloniaList.cs @@ -511,7 +511,7 @@ namespace Avalonia.Collections /// private void NotifyCountChanged() { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count")); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Count))); } /// diff --git a/src/Avalonia.Controls/Calendar/DatePicker.cs b/src/Avalonia.Controls/Calendar/DatePicker.cs index 2270598623..70de8bec16 100644 --- a/src/Avalonia.Controls/Calendar/DatePicker.cs +++ b/src/Avalonia.Controls/Calendar/DatePicker.cs @@ -954,7 +954,7 @@ namespace Avalonia.Controls } else { - var dateValidationError = new DatePickerDateValidationErrorEventArgs(new ArgumentOutOfRangeException("text", "SelectedDate value is not valid."), text); + var dateValidationError = new DatePickerDateValidationErrorEventArgs(new ArgumentOutOfRangeException(nameof(text), "SelectedDate value is not valid."), text); OnDateValidationError(dateValidationError); if (dateValidationError.ThrowException) diff --git a/src/Avalonia.Controls/GridLength.cs b/src/Avalonia.Controls/GridLength.cs index f6a608cd71..02be95b647 100644 --- a/src/Avalonia.Controls/GridLength.cs +++ b/src/Avalonia.Controls/GridLength.cs @@ -56,12 +56,12 @@ namespace Avalonia.Controls { if (value < 0 || double.IsNaN(value) || double.IsInfinity(value)) { - throw new ArgumentException("Invalid value", "value"); + throw new ArgumentException("Invalid value", nameof(value)); } if (type < GridUnitType.Auto || type > GridUnitType.Star) { - throw new ArgumentException("Invalid value", "type"); + throw new ArgumentException("Invalid value", nameof(type)); } _type = type; diff --git a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs index de68eb0ab0..57db1e19bb 100644 --- a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs +++ b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs @@ -487,7 +487,7 @@ namespace Avalonia.Controls { if (e == null) { - throw new ArgumentNullException("e"); + throw new ArgumentNullException(nameof(e)); } var handler = Spinned; diff --git a/src/Avalonia.Styling/Styling/Setter.cs b/src/Avalonia.Styling/Styling/Setter.cs index 54d0a7d40f..cfe17a4291 100644 --- a/src/Avalonia.Styling/Styling/Setter.cs +++ b/src/Avalonia.Styling/Styling/Setter.cs @@ -69,7 +69,7 @@ namespace Avalonia.Styling { throw new ArgumentException( "Cannot assign a control to Setter.Value. Wrap the control in a