It is possible to override the TryGetIndex method of a dynamic object to access the dynamic object properties by index however I am dealing with an Expandoobject (of the System.dynamic namespace) which you can't inherit from. Is there a way around this? Thanks
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
ExpandoObject
is nothing but a fancyIDictionary
which leverages the DLR.There is no way you can access a
IDictionary<TKey,TValue>
via index. You may findElementAt
method of linq useful, but it is not. There is no ordering in dictionary, You can read more about hashtable datastructure(Dictionary is also a hashtable).For accessing dictionary via index you may use
OrderedDictionary
. One disadvantage is that is is not generic.Know more about issues when accessing elements via index from a Dictionary