PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.Dictionaries.DictionaryWrappingObject Class Reference

Wraps an object in a dictionary interface. More...

Inheritance diagram for PeanutButter.Utils.Dictionaries.DictionaryWrappingObject:
PeanutButter.Utils.Dictionaries.IWrapper

Public Member Functions

object Unwrap ()
 Unwrap the wrapped object as a plain old object.
Returns

 
T Unwrap< T > ()
 Unwrap the wrapped object with a hard cast to T (buyer beware!)
Template Parameters
T
Returns

 
bool TryUnwrap< T > (out T result)
 Attempts to unwrap a wrapped value.
Template Parameters
T
Returns

 
 DictionaryWrappingObject (object wrapped)
 Provides a mechanism to reflectively read and write members on an object via an IDictionary<string, object> interface.
 
 DictionaryWrappingObject (object wrapped, StringComparer keyComparer)
 Provides a mechanism to reflectively read and write members on an object via an IDictionary<string, object> interface with keys matched by the provided keyComparer.
 
 DictionaryWrappingObject (object wrapped, WrapOptions options)
 Provides a mechanism to reflectively read members on an object via an IDictionary<string, object> interface where the keyComparer used is StringComparer.Ordinal.
 
 DictionaryWrappingObject (object wrapped, StringComparer keyComparer, WrapOptions options)
 Provides a mechanism to reflectively read members on an object via an IDictionary<string, object> interface.
 
IEnumerator< KeyValuePair< string, object > > GetEnumerator ()
 
void Add (KeyValuePair< string, object > item)
 
void Clear ()
 
bool Contains (KeyValuePair< string, object > item)
 
void CopyTo (KeyValuePair< string, object >[] array, int arrayIndex)
 
bool Remove (KeyValuePair< string, object > item)
 
bool ContainsKey (string key)
 
void Add (string key, object value)
 
bool Remove (string key)
 
bool TryGetValue (string key, out object value)
 

Properties

StringComparer Comparer [get]
 The string comparer used to locate keys.
 
int Count [get]
 
bool IsReadOnly [get]
 
object this[string key] [get, set]
 
ICollection< stringKeys [get]
 
ICollection< objectValues [get]
 

Detailed Description

Wraps an object in a dictionary interface.

Constructor & Destructor Documentation

◆ DictionaryWrappingObject() [1/4]

PeanutButter.Utils.Dictionaries.DictionaryWrappingObject.DictionaryWrappingObject ( object  wrapped)

Provides a mechanism to reflectively read and write members on an object via an IDictionary<string, object> interface.

Parameters
wrapped

◆ DictionaryWrappingObject() [2/4]

PeanutButter.Utils.Dictionaries.DictionaryWrappingObject.DictionaryWrappingObject ( object  wrapped,
StringComparer  keyComparer 
)

Provides a mechanism to reflectively read and write members on an object via an IDictionary<string, object> interface with keys matched by the provided keyComparer.

Parameters
wrapped
keyComparer

◆ DictionaryWrappingObject() [3/4]

PeanutButter.Utils.Dictionaries.DictionaryWrappingObject.DictionaryWrappingObject ( object  wrapped,
WrapOptions  options 
)

Provides a mechanism to reflectively read members on an object via an IDictionary<string, object> interface where the keyComparer used is StringComparer.Ordinal.

Parameters
wrapped
options

◆ DictionaryWrappingObject() [4/4]

PeanutButter.Utils.Dictionaries.DictionaryWrappingObject.DictionaryWrappingObject ( object  wrapped,
StringComparer  keyComparer,
WrapOptions  options 
)

Provides a mechanism to reflectively read members on an object via an IDictionary<string, object> interface.

Parameters
wrapped
keyComparerSpecify the key-comparer to use when reaching into objects
  • the default is case-sensitive, ordinal, but you can make your wrapper instance more "forgiving" with a case-insensitive key-comparer
optionsSpecific options for this wrapping

Member Function Documentation

◆ TryUnwrap< T >()

bool PeanutButter.Utils.Dictionaries.DictionaryWrappingObject.TryUnwrap< T > ( out T  result)

Attempts to unwrap a wrapped value.

Template Parameters
T
Returns

Implements PeanutButter.Utils.Dictionaries.IWrapper.

◆ Unwrap()

object PeanutButter.Utils.Dictionaries.DictionaryWrappingObject.Unwrap ( )

Unwrap the wrapped object as a plain old object.

Returns

Implements PeanutButter.Utils.Dictionaries.IWrapper.

◆ Unwrap< T >()

Unwrap the wrapped object with a hard cast to T (buyer beware!)

Template Parameters
T
Returns

Implements PeanutButter.Utils.Dictionaries.IWrapper.


The documentation for this class was generated from the following file: