Peter Duniho
10/27/2008 7:23:00 PM
On Mon, 27 Oct 2008 12:11:09 -0700, Co Co Net <coconet@community.nospam>
wrote:
> [...]
> class bar : Panel
> {
> public void LookParent()
> {
> if ( this.parentForm.GetType().ImplementsAnInterface( IMine) )
> {
> string ok = "iok";
> }
> }
> }
>
> As far as I know there is no method called "ImplementsAnInterface", so
> how can I make one?
Use the "is" operator:
if (this.parentForm is IMine)
{
string ok = "iok";
}
There is in fact a method on the Type class that returns similar
information, but if you have an instance, you don't need it.
Pete