Example #1
0
 private CacheDictionary(TryResolveValue tryResolveValue, ResolveValue resolveValue, IMinimalDictionary valuesContainer, IMinimalSet unsetValuesContainer)
 {
     this.tryResolveValue = tryResolveValue;
     this.resolveValue    = resolveValue;
     this.values          = valuesContainer;
     this.unsetValues     = unsetValuesContainer;
 }
Example #2
0
        public static object GetValue(this IMinimalDictionary minimalDictionary, object key)
        {
            object value;

            if (minimalDictionary.TryGetValue(key, out value))
            {
                return(value);
            }

            throw new Granular.Exception("The given key was not present in the dictionary.");
        }
Example #3
0
        public static TValue GetValue <TKey, TValue>(this IMinimalDictionary <TKey, TValue> minimalDictionary, TKey key)
        {
            TValue value;

            if (minimalDictionary.TryGetValue(key, out value))
            {
                return(value);
            }

            throw new Granular.Exception("The given key was not present in the dictionary.");
        }
Example #4
0
        private DependencyProperty(DependencyPropertyHashKey hashKey, Type propertyType, PropertyMetadata metadata, ValidateValueCallback validateValueCallback, bool isAttached, bool isReadOnly)
        {
            this.hashKey               = hashKey;
            this.Name                  = hashKey.Name;
            this.OwnerType             = hashKey.Owner;
            this.PropertyType          = propertyType;
            this.ValidateValueCallback = validateValueCallback;
            this.IsReadOnly            = isReadOnly;
            this.Inherits              = metadata.Inherits;
            this.StringKey             = hashKey.StringKey;
            this.hashCode              = hashKey.GetHashCode();

            this.ownerMetadata = metadata;
            this.IsAttached    = isAttached;

            typeMetadata = new ConvertedStringDictionary <Type, PropertyMetadata>(type => type.FullName);
            typeMetadata.Add(OwnerType, ownerMetadata);

            typeMetadataCache = CacheDictionary <Type, PropertyMetadata> .CreateUsingStringKeys(ResolveTypeMetadata, type => type.FullName);

            typeContainsCache = CacheDictionary <Type, bool> .CreateUsingStringKeys(ResolveTypeContains, type => type.FullName);
        }
Example #5
0
 public ConvertedStringDictionary(Func <TKey, string> getStringKey = null)
 {
     this.keys         = new Granular.Compatibility.StringDictionary();
     this.values       = new Granular.Compatibility.StringDictionary();
     this.getStringKey = getStringKey ?? (key => key.ToString());
 }
Example #6
0
 public ConvertedStringSet(Func <T, string> getStringItem = null)
 {
     this.items         = new Granular.Compatibility.StringDictionary();
     this.getStringItem = getStringItem ?? (item => item.ToString());
 }