Actually make trait filter work and get rid of lots unnecessary allocation

This commit is contained in:
Dustin Campbell
2015-12-06 07:14:36 -08:00
parent f1879e1a06
commit dbbb6b3fad
5 changed files with 63 additions and 58 deletions
@@ -87,6 +87,20 @@ namespace xunit.runner.wpf.ViewModel
}
}
public TraitViewModel GetOrAdd(string text)
{
var index = this.Children.BinarySearch(text, StringComparer.Ordinal, vm => vm.Text);
if (index < 0)
{
var viewModel = new TraitViewModel(this, text);
this.Children.Insert(~index, viewModel);
return viewModel;
}
return this.Children[index];
}
public bool? IsChecked
{
get { return _isChecked; }