ListBox object is binded with BindingList<KeyValuePair<string, string>>
On SelectionChanged event I need to get selected item as KeyValuePair<string, string>
Following code gives error because KeyValuePair can’t be used as reference type.
KeyValuePair<string, string> selectedProperty = listProperties.SelectedItem as KeyValuePair<string, string>;
What is good work-around for this?
Try using a direct cast instead of
as: