private static void CountErrors(Dictionary <string, int> map, ImmutableArray <DiagnosticData> diagnostics) { if (diagnostics.IsDefaultOrEmpty) { return; } foreach (var group in diagnostics.GroupBy(d => d.Id)) { map[group.Key] = IDictionaryExtensions.GetValueOrDefault(map, group.Key) + group.Count(); } }
private static ISuspendState GetSuspendState(this DependencyObject depObj, DependencyProperty dependencyProperty, bool create) { var suspendProps = create ? depObj.GetValueOrCreate(SuspendedPropertiesProperty, () => new Dictionary <DependencyProperty, ISuspendState>()) : depObj.GetValue <Dictionary <DependencyProperty, ISuspendState> >(SuspendedPropertiesProperty); if (suspendProps == null) { return(DummySuspendState.Instance); } return(create ? suspendProps.GetValueOrCreate(dependencyProperty, () => new SuspendState()) : IDictionaryExtensions.GetValueOrDefault(suspendProps, dependencyProperty, DummySuspendState.Instance)); }
public TValue GetValueOrDefault(TKey key, TValue defaultValue = default(TValue)) { return(IDictionaryExtensions.GetValueOrDefault(_key2ValueDictionary, key, defaultValue)); }
public TKey GetKeyOrDefault(TValue value, TKey defaultKey = default(TKey)) { return(IDictionaryExtensions.GetValueOrDefault(_value2KeyDictionary, value, defaultKey)); }
public Size GetCustomSize(int reduceLevel) { EnsureCustomSizeDictionary(); return(IDictionaryExtensions.GetValueOrDefault(_customSizes, reduceLevel, Size.Empty)); }