2using System.Collections.Generic;
4using System.Threading.Tasks;
5using YamlDotNet.Core.Tokens;
9public static class Cola
16 => items.ToDictionary(i => i.key, i => i.value);
22 this IReadOnlyDictionary<Key, Value>? a,
23 IReadOnlyDictionary<Key, Value>? b
26 if (a ==
null)
return b;
27 if (b ==
null)
return a;
29 var result = a.ToDictionary();
32 result[i.Key] = i.Value;
42 this IDictionary<Key, Value>? a,
43 IDictionary<Key, Value>? b
46 if (a ==
null)
return b;
47 if (b ==
null)
return a;
49 var result = a.ToDictionary();
52 result[i.Key] = i.Value;
61 public static T
With<T>(
this T
self, Action<T> operation)
73 operation?.Invoke(
self);
static ? T WithNullable< T >(this T? self, Action< T >? operation)
Simply invoke a task on an object which may be null and return that same object.
static ? IDictionary< Key, Value > MergeMutable< Key, Value >(this IDictionary< Key, Value >? a, IDictionary< Key, Value >? b)
Merge two dictionaries safely.
static T With< T >(this T self, Action< T > operation)
Simply invoke a task on an object and return that same object.
static ? IReadOnlyDictionary< Key, Value > Merge< Key, Value >(this IReadOnlyDictionary< Key, Value >? a, IReadOnlyDictionary< Key, Value >? b)
Merge two dictionaries safely.
static Dictionary< Key, Value > MakeDictionary< Key, Value >(params(Key key, Value value)[] items)
Syntax simplifier when new() cannot be used for dictionaries.