Browse Source

Merge pull request #3057 from MarchingCube/alloc-boxing

Misc boxing allocation removal.
pull/3060/head
Jumar Macato 7 years ago
committed by GitHub
parent
commit
45f36dbd41
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      samples/ControlCatalog/Pages/ListBoxPage.xaml.cs
  2. 2
      samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs
  3. 2
      src/Avalonia.Base/Utilities/SingleOrDictionary.cs
  4. 6
      src/Avalonia.Controls/Calendar/DatePicker.cs

2
samples/ControlCatalog/Pages/ListBoxPage.xaml.cs

@ -78,7 +78,7 @@ namespace ControlCatalog.Pages
}
}
private string GenerateItem() => $"Item {_counter++}";
private string GenerateItem() => $"Item {_counter++.ToString()}";
}
}
}

2
samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs

@ -11,7 +11,7 @@ namespace ControlCatalog.ViewModels
public ItemsRepeaterPageViewModel()
{
Items = new ObservableCollection<string>(
Enumerable.Range(1, 100000).Select(i => $"Item {i}"));
Enumerable.Range(1, 100000).Select(i => $"Item {i.ToString()}"));
}
public ObservableCollection<string> Items { get; }

2
src/Avalonia.Base/Utilities/SingleOrDictionary.cs

@ -38,7 +38,7 @@ namespace Avalonia.Utilities
{
if (dictionary == null)
{
if (!_singleValue.HasValue || !_singleValue.Value.Key.Equals(key))
if (!_singleValue.HasValue || !EqualityComparer<TKey>.Default.Equals(_singleValue.Value.Key, key))
{
value = default(TValue);
return false;

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

@ -1042,7 +1042,8 @@ namespace Avalonia.Controls
}
}
DateTime? d = SetTextBoxValue(s);
if (!SelectedDate.Equals(d))
if (SelectedDate != d)
{
SelectedDate = d;
}
@ -1058,7 +1059,8 @@ namespace Avalonia.Controls
else
{
DateTime? d = SetTextBoxValue(_defaultText);
if (!SelectedDate.Equals(d))
if (SelectedDate != d)
{
SelectedDate = d;
}

Loading…
Cancel
Save