I have the following function:
private void UserDetailTabControl_SelectionChanged(object sender, RadSelectionChangedEventArgs e)
{
RadTabControl obj = sender as RadTabControl;
if (obj.SelectedIndex != null)
But obj.SelectedIndex != null is giving me warning. The result of the expression is always 'true' since a value of type 'int' is never equal to 'null' of type 'int?'
So how to solve this warning?
Why you need to check the SelectedIndex for, why not SelectedItem? To answer your question, SelectedIndex is of type int so the default value of SelectedIndex for TabControl should be -1/0 depending on the control that you are using. Thus, you cannot do
obj.SelectedIndex != null
,you can do
for check.