Testing if an Object is a Dictionary in C#

后端 未结 7 1171
傲寒
傲寒 2020-12-06 10:21

Is there a way to test if an object is a dictionary?

In a method I\'m trying to get a value from a selected item in a list box. In some circumstances, the list box

7条回答
  •  执念已碎
    2020-12-06 11:03

    You could be a little more generic and ask instead if it implements IDictionary. Then the KeyValue collection will contina plain Objects.

提交回复
热议问题