Repository navigation
EditableGrouping
kobi2294 edited this page Apr 18, 2019
·
3 revisions
Provides an editable implementation of the IGrouping<K, T> interface. This means you can set the key on the constructor (not changeable), and then add values.
- Use the
Keyproperty to read the key - Use the
Countproperty to read the number of values - Use the
AddandRemoveMethods to add or remove values - Use the
ContainesValueMethod to check if the groupings contains a specific value - Use the
RemoveWheremethod to remove multiple elements according to provided predicate - Use the
Resetmethod to replace the list of values with an alternative list
Use the ToEditableGrouping grouping to convert the following into EditableGrouping<K, T>:
IGrouping<K, T>-
IEnumerable<T>- providing a key
var eg = new MvvmKit.EditableGrouping<int, string>(4);
eg.Reset("Four", "Quattro", "Arba", "Vier");
eg.Add("yottsu");
Console.WriteLine($"There are {eg.Count} ways to say 4");
Console.WriteLine(String.Join(", ", eg));
eg.RemoveWhere(s => s.Length > 4);
Console.WriteLine("But these are the short ones:");
Console.WriteLine(String.Join(", ", eg));