Say I have 2 classes that inherit from the same interface.
class Foo : ISomeInterface
{
int a;
int b;
}
class Bar : ISomeInterface
{
float a;
float b;
}
Is there anyway I can create a method that automatically recognises the original class without casting but can take any class that inherits from ISomeInterface?
public void Method(ISomeInterface input)
{
// If Foo is input then one method is called
// If Bar is input then another method is called
}
EDIT:
I'm trying to avoid the "is" keyword.