Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public TValue GetValueOrDefault(TKey key, TValue defaultValue = default(TValue))
 {
     return(IDictionaryExtensions.GetValueOrDefault(_key2ValueDictionary, key, defaultValue));
 }
Ejemplo n.º 4
0
 public TKey GetKeyOrDefault(TValue value, TKey defaultKey = default(TKey))
 {
     return(IDictionaryExtensions.GetValueOrDefault(_value2KeyDictionary, value, defaultKey));
 }
Ejemplo n.º 5
0
 public Size GetCustomSize(int reduceLevel)
 {
     EnsureCustomSizeDictionary();
     return(IDictionaryExtensions.GetValueOrDefault(_customSizes, reduceLevel, Size.Empty));
 }