Browse Source

Use nameof where possible.

pull/2230/head
José Pedro 7 years ago
parent
commit
97d624a9ae
No known key found for this signature in database GPG Key ID: B8247B9301707B83
  1. 2
      src/Avalonia.Animation/IterationCount.cs
  2. 4
      src/Avalonia.Base/Collections/AvaloniaDictionary.cs
  3. 2
      src/Avalonia.Base/Collections/AvaloniaList.cs
  4. 2
      src/Avalonia.Controls/Calendar/DatePicker.cs
  5. 4
      src/Avalonia.Controls/GridLength.cs
  6. 2
      src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
  7. 2
      src/Avalonia.Styling/Styling/Setter.cs

2
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;

4
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}]"));

2
src/Avalonia.Base/Collections/AvaloniaList.cs

@ -511,7 +511,7 @@ namespace Avalonia.Collections
/// </summary>
private void NotifyCountChanged()
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count"));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Count)));
}
/// <summary>

2
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)

4
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;

2
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;

2
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 <Template>.",
"value");
nameof(value));
}
_value = value;

Loading…
Cancel
Save