How to make the following extension works? I'm binding the ComboBoxe to an enum and in this case it doesn't compile because it returns null
.
public static T GetSelectedValue<T>(this ComboBox control)
{
if (control.SelectedValue == null)
return null;
return (T)control.SelectedValue;
}
Note: I want it te return null (instead of default(T)). The question is that what's the where expression that I've got to use?