Code inspection: Use 'is' operator
This inspection suggests replacing IsInstanceOfType()
invocations with the is
keyword. Both ways of checking the object type are identical performance-wise, but is
keyword is better in terms of readability.
public bool IsString(object value)
{
return typeof(string).IsInstanceOfType(value);
}
public bool IsString(object value)
{
return value is string;
}
Last modified: 30 July 2024