Given this scenario
interface A {}
class B : A {}
A b = new B();
How can I check that object b is created from interface A?
Try to use is
if(b is A)
{
// do something
}
is that what you want?
You could do test it like this:
var b = new B();
var asInterface = x as A;
if (asInterface == null)
{
//not of the interface A!
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With