Exemple #1
0
 internal DictionaryPropertyDescriptor(IExpandableIndexer d, string key, string propertyName, string displayName)
     : base(displayName, null)
 {
     _propertyName = propertyName;
     _dictionary   = d;
     _key          = key;
 }
Exemple #2
0
        static Type GetIndexerValueType(IExpandableIndexer indexer)
        {
            // Most indexers use strings, but a few derive from GenericIndexer, in which case the
            // 2nd generic type argument dictates the value type of the indexer:

            var indexerType = indexer.GetType();

            while (indexerType != null && !indexerType.IsGenericType)
            {
                indexerType = indexerType.BaseType;
            }
            if (indexerType != null && indexerType.Name == "GenericIndexer`2")
            {
                return(indexerType.GenericTypeArguments[1]);
            }

            return(typeof(string));
        }