Search Results for

    Show / Hide Table of Contents

    Class DynamicDictionary

    A dictionary that supports dynamic access.

    Inheritance
    object
    DynamicObject
    DynamicDictionary
    Implements
    IDynamicMetaObjectProvider
    IEquatable<DynamicDictionary>
    IEnumerable<string>
    IDictionary<string, DynamicValue>
    ICollection<KeyValuePair<string, DynamicValue>>
    IEnumerable<KeyValuePair<string, DynamicValue>>
    IEnumerable
    Inherited Members
    DynamicObject.GetMetaObject(Expression)
    DynamicObject.TryBinaryOperation(BinaryOperationBinder, object, out object)
    DynamicObject.TryConvert(ConvertBinder, out object)
    DynamicObject.TryCreateInstance(CreateInstanceBinder, object[], out object)
    DynamicObject.TryDeleteIndex(DeleteIndexBinder, object[])
    DynamicObject.TryDeleteMember(DeleteMemberBinder)
    DynamicObject.TryGetIndex(GetIndexBinder, object[], out object)
    DynamicObject.TryInvoke(InvokeBinder, object[], out object)
    DynamicObject.TryInvokeMember(InvokeMemberBinder, object[], out object)
    DynamicObject.TrySetIndex(SetIndexBinder, object[], object)
    DynamicObject.TryUnaryOperation(UnaryOperationBinder, out object)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: OpenSearch.Net
    Assembly: OpenSearch.Net.dll
    Syntax
    public class DynamicDictionary : DynamicObject, IDynamicMetaObjectProvider, IEquatable<DynamicDictionary>, IEnumerable<string>, IDictionary<string, DynamicValue>, ICollection<KeyValuePair<string, DynamicValue>>, IEnumerable<KeyValuePair<string, DynamicValue>>, IEnumerable

    Properties

    | Edit this page View Source

    Count

    Gets the number of elements contained in the DynamicDictionary.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    The number of elements contained in the DynamicDictionary.

    | Edit this page View Source

    Empty

    Returns an empty dynamic dictionary.

    Declaration
    public static DynamicDictionary Empty { get; }
    Property Value
    Type Description
    DynamicDictionary

    A DynamicDictionary instance.

    | Edit this page View Source

    IsReadOnly

    Gets a value indicating whether the DynamicDictionary is read-only.

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    bool

    Always returns false.

    | Edit this page View Source

    this[string]

    Gets or sets the DynamicValue with the specified name.

    Declaration
    public DynamicValue this[string name] { get; set; }
    Parameters
    Type Name Description
    string name
    Property Value
    Type Description
    DynamicValue

    A DynamicValue instance containing a value.

    | Edit this page View Source

    Keys

    Gets an ICollection<T> containing the keys of the DynamicDictionary.

    Declaration
    public ICollection<string> Keys { get; }
    Property Value
    Type Description
    ICollection<string>

    An ICollection<T> containing the keys of the DynamicDictionary.

    | Edit this page View Source

    Values

    Gets an ICollection<T> containing the values in the DynamicDictionary.

    Declaration
    public ICollection<DynamicValue> Values { get; }
    Property Value
    Type Description
    ICollection<DynamicValue>

    An ICollection<T> containing the values in the DynamicDictionary.

    Methods

    | Edit this page View Source

    Add(KeyValuePair<string, DynamicValue>)

    Adds an item to the DynamicDictionary.

    Declaration
    public void Add(KeyValuePair<string, DynamicValue> item)
    Parameters
    Type Name Description
    KeyValuePair<string, DynamicValue> item

    The object to add to the DynamicDictionary.

    | Edit this page View Source

    Add(string, DynamicValue)

    Adds an element with the provided key and value to the DynamicDictionary.

    Declaration
    public void Add(string key, DynamicValue value)
    Parameters
    Type Name Description
    string key

    The object to use as the key of the element to add.

    DynamicValue value

    The object to use as the value of the element to add.

    | Edit this page View Source

    Clear()

    Removes all items from the DynamicDictionary.

    Declaration
    public void Clear()
    | Edit this page View Source

    Contains(KeyValuePair<string, DynamicValue>)

    Determines whether the DynamicDictionary contains a specific value.

    Declaration
    public bool Contains(KeyValuePair<string, DynamicValue> item)
    Parameters
    Type Name Description
    KeyValuePair<string, DynamicValue> item

    The object to locate in the DynamicDictionary.

    Returns
    Type Description
    bool

    true if item is found in the DynamicDictionary; otherwise, false.

    | Edit this page View Source

    ContainsKey(string)

    Determines whether the DynamicDictionary contains an element with the specified key.

    Declaration
    public bool ContainsKey(string key)
    Parameters
    Type Name Description
    string key

    The key to locate in the DynamicDictionary.

    Returns
    Type Description
    bool

    true if the DynamicDictionary contains an element with the key; otherwise, false.

    | Edit this page View Source

    CopyTo(KeyValuePair<string, DynamicValue>[], int)

    Copies the elements of the DynamicDictionary to an Array, starting at a particular Array index.

    Declaration
    public void CopyTo(KeyValuePair<string, DynamicValue>[] array, int arrayIndex)
    Parameters
    Type Name Description
    KeyValuePair<string, DynamicValue>[] array

    The one-dimensional Array that is the destination of the elements copied from the DynamicDictionary. The Array must have zero-based indexing.

    int arrayIndex

    The zero-based index in array at which copying begins.

    | Edit this page View Source

    Create(IDictionary<string, object>)

    Creates a dynamic dictionary from an IDictionary<TKey, TValue> instance.

    Declaration
    public static DynamicDictionary Create(IDictionary<string, object> values)
    Parameters
    Type Name Description
    IDictionary<string, object> values

    An IDictionary<TKey, TValue> instance, that the dynamic dictionary should be created from.

    Returns
    Type Description
    DynamicDictionary

    An DynamicDictionary instance.

    | Edit this page View Source

    Equals(DynamicDictionary)

    Indicates whether the current DynamicDictionary is equal to another object of the same type.

    Declaration
    public bool Equals(DynamicDictionary other)
    Parameters
    Type Name Description
    DynamicDictionary other

    An DynamicDictionary instance to compare with this instance.

    Returns
    Type Description
    bool

    true if the current instance is equal to the other parameter; otherwise, false.

    | Edit this page View Source

    Equals(object)

    Determines whether the specified object is equal to this instance.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with this instance.

    Returns
    Type Description
    bool

    true if the specified object is equal to this instance; otherwise, false.

    Overrides
    object.Equals(object)
    | Edit this page View Source

    GetDynamicMemberNames()

    Returns the enumeration of all dynamic member names.

    Declaration
    public override IEnumerable<string> GetDynamicMemberNames()
    Returns
    Type Description
    IEnumerable<string>

    A IEnumerable<T> that contains dynamic member names.

    Overrides
    DynamicObject.GetDynamicMemberNames()
    | Edit this page View Source

    GetEnumerator()

    Returns the enumeration of all dynamic member names.

    Declaration
    public IEnumerator<string> GetEnumerator()
    Returns
    Type Description
    IEnumerator<string>

    A IEnumerable<T> that contains dynamic member names.

    | Edit this page View Source

    GetHashCode()

    Returns a hash code for this DynamicDictionary.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for this DynamicDictionary, suitable for use in hashing algorithms and data structures like a hash table.

    Overrides
    object.GetHashCode()
    | Edit this page View Source

    GetKeyValues()

    Backwards compatible access to all the KeyValue pairs, in the next release you will be able to foreach directly

    Declaration
    public IEnumerable<KeyValuePair<string, DynamicValue>> GetKeyValues()
    Returns
    Type Description
    IEnumerable<KeyValuePair<string, DynamicValue>>
    | Edit this page View Source

    Get<T>(string)

    Traverses data using path notation.

    e.g some.deep.nested.json.path

    A special lookup is available for ANY key _arbitrary_key_ e.g some.deep._arbitrary_key_.json.path which will traverse into the first key

    If _arbitrary_key_ is the last value it will return the key name

    Declaration
    public T Get<T>(string path)
    Parameters
    Type Name Description
    string path

    path into the stored object, keys are separated with a dot and the last key is returned as T

    Returns
    Type Description
    T

    T or default

    Type Parameters
    Name Description
    T
    | Edit this page View Source

    Remove(KeyValuePair<string, DynamicValue>)

    Removes the first occurrence of a specific object from the DynamicDictionary.

    Declaration
    public bool Remove(KeyValuePair<string, DynamicValue> item)
    Parameters
    Type Name Description
    KeyValuePair<string, DynamicValue> item

    The object to remove from the DynamicDictionary.

    Returns
    Type Description
    bool

    true if item was successfully removed from the DynamicDictionary; otherwise, false.

    | Edit this page View Source

    Remove(string)

    Removes the element with the specified key from the DynamicDictionary.

    Declaration
    public bool Remove(string key)
    Parameters
    Type Name Description
    string key

    The key of the element to remove.

    Returns
    Type Description
    bool

    true if the element is successfully removed; otherwise, false.

    | Edit this page View Source

    ToDictionary()

    Creates a new instance of Dictionary{String,Object} using the keys and underlying object values of this DynamicDictionary instance's key values.

    Declaration
    public Dictionary<string, object> ToDictionary()
    Returns
    Type Description
    Dictionary<string, object>
    | Edit this page View Source

    TryGetMember(GetMemberBinder, out object)

    Provides the implementation for operations that get member values. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as getting a value for a property.

    Declaration
    public override bool TryGetMember(GetMemberBinder binder, out object result)
    Parameters
    Type Name Description
    GetMemberBinder binder

    Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the DynamicObject class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.

    object result

    The result of the get operation. For example, if the method is called for a property, you can assign the property value to result.

    Returns
    Type Description
    bool

    true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)

    Overrides
    DynamicObject.TryGetMember(GetMemberBinder, out object)
    | Edit this page View Source

    TryGetValue(string, out DynamicValue)

    Gets the value associated with the specified key.

    Declaration
    public bool TryGetValue(string key, out DynamicValue value)
    Parameters
    Type Name Description
    string key

    The key whose value to get.

    DynamicValue value

    When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

    Returns
    Type Description
    bool

    true if the DynamicDictionary contains an element with the specified key; otherwise, false.

    | Edit this page View Source

    TrySetMember(SetMemberBinder, object)

    Provides the implementation for operations that set member values. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as setting a value for a property.

    Declaration
    public override bool TrySetMember(SetMemberBinder binder, object value)
    Parameters
    Type Name Description
    SetMemberBinder binder

    Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the DynamicObject class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.

    object value

    The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the DynamicObject class, the value is "Test".

    Returns
    Type Description
    bool

    true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)

    Overrides
    DynamicObject.TrySetMember(SetMemberBinder, object)

    Implements

    IDynamicMetaObjectProvider
    IEquatable<T>
    IEnumerable<T>
    IDictionary<TKey, TValue>
    ICollection<T>
    IEnumerable<T>
    IEnumerable

    Extension Methods

    SuffixExtensions.Suffix(object, string)
    • Edit this page
    • View Source
    In this article
    • Properties
      • Count
      • Empty
      • IsReadOnly
      • this[string]
      • Keys
      • Values
    • Methods
      • Add(KeyValuePair<string, DynamicValue>)
      • Add(string, DynamicValue)
      • Clear()
      • Contains(KeyValuePair<string, DynamicValue>)
      • ContainsKey(string)
      • CopyTo(KeyValuePair<string, DynamicValue>[], int)
      • Create(IDictionary<string, object>)
      • Equals(DynamicDictionary)
      • Equals(object)
      • GetDynamicMemberNames()
      • GetEnumerator()
      • GetHashCode()
      • GetKeyValues()
      • Get<T>(string)
      • Remove(KeyValuePair<string, DynamicValue>)
      • Remove(string)
      • ToDictionary()
      • TryGetMember(GetMemberBinder, out object)
      • TryGetValue(string, out DynamicValue)
      • TrySetMember(SetMemberBinder, object)
    • Implements
    • Extension Methods
    Back to top Generated by DocFX