PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.Dictionaries Namespace Reference

Classes

class  CaseWarpingDictionaryWrapper< TValue >
 Provides a read/write-through shim for another dictionary with the desired case sensitivity access. More...
class  DefaultDictionary< TKey, TValue >
 Provides a Dictionary class which returns default values for unknown keys (like Python's defaultdict) More...
class  DictionaryWrappingConnectionStringSettingCollection
 Provides a convenient IDictionary wrapper for ConnectionStringCollections. More...
class  DictionaryWrappingConnectionStringSettingCollection< TValue >
 Provides a mechanism for wrapping read-write access to a ConnectionStringSettingsCollection in the IDictionary<string, string> interface to simplify shimming other types. More...
class  DictionaryWrappingConnectionStringSettingCollectionEnumerator< TValue >
class  DictionaryWrappingNameValueCollection
 Provides a convenient IDictionary wrapper for NameValueCollections. More...
class  DictionaryWrappingNameValueCollection< TValue >
 Wraps a NameValueCollection in an IDictionary interface. More...
class  DictionaryWrappingNameValueCollectionEnumerator< TValue >
 Wraps a NameValueCollection in a Dictionary interface.
class  DictionaryWrappingObject
 Wraps an object in a dictionary interface. More...
class  DictionaryWrappingObjectEnumerator
class  FakeProperty
class  GenericDictionaryEnumerator< TKey, TValue >
interface  IOrderedDictionary< TKey, TValue >
interface  IWrapper
 Defines an object which is wrapping another object and can be unwrapped with the provided methods. More...
class  MergeDictionary< TKey, TValue >
 Provides a mechanism to merge multiple dictionaries into one Source dictionaries. More...
class  OrderedDictionary< TKey, TValue >
class  RedirectingDictionary< TValue >
 Provides a wrapping read-write layer around another dictionary effectively allowing transparent rename of the keys. More...
class  RedirectingDictionaryEnumerator< T >
class  TransformingDictionary< TKey, TValue >
 Provides access to an underlying dictionary with the keys held intact and the values passed through a transform. More...
class  ValidatingDictionary< TKey, TValue >
 Provides a dictionary implementation which allows for a validation action for keys, values and pairs. More...
class  ValueMutatingEnumerator< TKey, TValue >

Enumerations

enum  DefaultDictionaryFlags { None = 0 , CacheResolvedDefaults , ReportMissingKeys }
 Flags which may be set when constructing a DefaultDictionary to control operations. More...
enum  WrapOptions { None , WrapRecursively , ForceWrappingDictionariesWithoutStringKeys , CopyOnWrite }
 Options for wrapping objects - apply as bitfield. More...
enum  Mutation { Create , Update , Remove , Clear }
 Actions which can be performed on a ValidatingDictionary. The action will be passed into the validator so that the consumer can do tricks like allowing adding certain keys but not removing them. More...

Enumeration Type Documentation

◆ DefaultDictionaryFlags

Flags which may be set when constructing a DefaultDictionary to control operations.

Enumerator
None 

No options set.

CacheResolvedDefaults 

When set, default values which are resolved via the resolver function will be stored for future use in the internal data store - they will not be regenerated on each successive request.

ReportMissingKeys 

When set, ContainsKey will return false for keys which are actually missing from the internal data store, even though reading via the indexer will return the calculated default value.

◆ Mutation

Actions which can be performed on a ValidatingDictionary. The action will be passed into the validator so that the consumer can do tricks like allowing adding certain keys but not removing them.

Enumerator
Create 

New item is being added.

Update 

Existing item is being updated.

Remove 

Existing item is being removed - this is only raised if the item would actually be removed.

Clear 

All items are being cleared.

◆ WrapOptions

Options for wrapping objects - apply as bitfield.

Enumerator
None 

No special options:

  • wrap first layer only
  • attempt write-back
  • throw when encountering a dictionary with non-string keys (as the resultant behavior is probably unexpected)
WrapRecursively 

Wrap the object recursively, ie complex-object properties are also wrapped on access.

ForceWrappingDictionariesWithoutStringKeys 

Ordinarily, if this wrapper encounters something implementing IDictionary<,>, then it will attempt to wrap into the key-value collection if, and only if the keys for that collection are strings. This means that normally, if provided a dictionary with non-string keys, wrapping will fail with an ArgumentException. If you're sure you'd like to wrap the actual properties of a dictionary, not the values in the dictionary, force wrapping by setting this to true.

CopyOnWrite 

Write operations don't actually write back to the original object - instead a shadow is created (copy-on-write). Reading from the dictionary will return the written value where reading from the underlying object will still return the original value - useful when you'd like to wrap an anonymous object and plan on making some writes and then reading back from the dictionary.