How can I use the is
keyword with an object, rather than an object's class?
Here is some code:
private bool IsObjectCompatableWithObjects(object obj, IEnumerable<object> objects)
{
foreach (var item in objects)
{
if (obj is item)
{
return true;
}
}
return false;
}
The above code has the following error:
The type or namespace name 'item' could not be found (are you missing a using directive or an assembly reference?)