Browse Source

Use nameof where possible.

pull/2230/head
José Pedro 8 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) if (type > IterationType.Infinite)
{ {
throw new ArgumentException("Invalid value", "type"); throw new ArgumentException("Invalid value", nameof(type));
} }
_type = type; _type = type;

4
src/Avalonia.Base/Collections/AvaloniaDictionary.cs

@ -148,7 +148,7 @@ namespace Avalonia.Collections
{ {
if (_inner.TryGetValue(key, out TValue value)) 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}]")); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs($"Item[{key}]"));
if (CollectionChanged != null) if (CollectionChanged != null)
@ -209,7 +209,7 @@ namespace Avalonia.Collections
private void NotifyAdd(TKey key, TValue value) 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}]")); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs($"Item[{key}]"));

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

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

2
src/Avalonia.Controls/Calendar/DatePicker.cs

@ -954,7 +954,7 @@ namespace Avalonia.Controls
} }
else 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); OnDateValidationError(dateValidationError);
if (dateValidationError.ThrowException) 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)) 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) if (type < GridUnitType.Auto || type > GridUnitType.Star)
{ {
throw new ArgumentException("Invalid value", "type"); throw new ArgumentException("Invalid value", nameof(type));
} }
_type = type; _type = type;

2
src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs

@ -487,7 +487,7 @@ namespace Avalonia.Controls
{ {
if (e == null) if (e == null)
{ {
throw new ArgumentNullException("e"); throw new ArgumentNullException(nameof(e));
} }
var handler = Spinned; var handler = Spinned;

2
src/Avalonia.Styling/Styling/Setter.cs

@ -69,7 +69,7 @@ namespace Avalonia.Styling
{ {
throw new ArgumentException( throw new ArgumentException(
"Cannot assign a control to Setter.Value. Wrap the control in a <Template>.", "Cannot assign a control to Setter.Value. Wrap the control in a <Template>.",
"value"); nameof(value));
} }
_value = value; _value = value;

Loading…
Cancel
Save