Re: Determining if one type inherits from another type
- From: Pavel Minaev <int19h@xxxxxxxxx>
- Date: Thu, 21 Aug 2008 04:45:18 -0700 (PDT)
On Aug 21, 12:53 pm, Marc Gravell <marc.grav...@xxxxxxxxx> wrote:
For classes, you can use:
type1.IsSubclassOf(type2)
If you mean interfaces, this i slightly tricker - but IsAssignableFrom
might do the job.
Note that IsSubclassOf will return false if type1==type2 (which is
expected, given its name, but may be surprising in a sense that this
behavior is different from the "is" operator).
The most generic way to do this, which will handle the case described
above, as well as interfaces, is indeed Type.IsAssignableFrom.
.
- Prev by Date: problem with ado.net application
- Next by Date: Re: problem with ado.net application
- Previous by thread: problem with ado.net application
- Next by thread: Re: Determining if one type inherits from another type
- Index(es):
Loading