I have the following code:
[SuppressMessage( "Microsoft.Performance", "CA1800:DoNotCastUnnecessarily" )]
private static void SetTestConnectionString( Component table )
{
if( table is Object1 )
{
fn1( (Object1)table );
}
}
However, when I run FxCopon this class / function, it still generates a warning
warning: CA1800: Microsoft.Performance: 'table', parameter, is cast to type "xxx" several times in the method 'Ccc.SetTestConnectionString (Component)'. Cache the result of an "like" statement or direct casting to eliminate redundant instruction class.
I know that I can reorganize this code to remove the warning, however this will make the code less readable. In this case, I would like to suppress this one message on this one function.
What am I doing wrong?