Actually make trait filter work and get rid of lots unnecessary allocation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
@@ -26,6 +27,20 @@ namespace xunit.runner.wpf.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public TraitViewModel GetOrAdd(string text)
|
||||
{
|
||||
var index = this.Collection.BinarySearch(text, StringComparer.Ordinal, vm => vm.Text);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
var viewModel = new TraitViewModel(text);
|
||||
this.Collection.Insert(~index, viewModel);
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
return this.Collection[index];
|
||||
}
|
||||
|
||||
public ISet<TraitViewModel> GetCheckedTraits()
|
||||
{
|
||||
return new HashSet<TraitViewModel>(
|
||||
|
||||
Reference in New Issue
Block a user