Testing if an Object is a Dictionary in C#

后端 未结 7 1063
傲寒
傲寒 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:18
    if(typeof(IDictionary).IsAssignableFrom(listBox.ItemsSource.GetType()))
    {
    
    }
    
    0 讨论(0)
提交回复
热议问题