3 ms·
I often think it's a shame there isn't a "GetOrDefault" for dictionaries. An extension like > dict<k,v>.GetOrDefault(k key,v valueIfNotPresent) Would be real
by 7777fps 7y ago
I often think it's a shame there isn't a "GetOrDefault" for dictionaries.
An extension like
> dict<k,v>.GetOrDefault(k key,v valueIfNotPresent)
Would be really helpful. It's easy enough to write your own extension to do this, but something built in would be the kind of nice to have method that has been creeping into .net.
- SigmundA 7y agoYes I agree, ImmutableDictionary has GetValueOrDefault, GetOrAdd is nice on ConcurrentDictionary and FirstOrDefault is nice in Linq.