-
Notifications
You must be signed in to change notification settings - Fork 1
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
Key
property to read the key - Use the
Count
property to read the number of values - Use the
Add
andRemove
Methods to add or remove values - Use the
ContainesValue
Method to check if the groupings contains a specific value - Use the
RemoveWhere
method to remove multiple elements according to provided predicate - Use the
Reset
method 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));