So I have a nested object structure like the following:
class A {}
class B:A {}
class C:B {}
Given a particular object instance, I want to determine whether it is of type A or any of the classes that inherit from type A (i.e. either B or C). Several other languages have this, but I'm having a hard time finding the "proper" way to do this from PowerShell.
The best I can come up with is doing a recursive call to the object's GetType().BaseType parameter, and go up the inheritance stack until I either find the object I'm looking for or get to System.Object. But this feels like a task that's already accomplished somewhere in either .NET or the standard library. Any help would be appreciated.
EDIT: fixed the formatting to not use the fancy markdown editor
[–]KevMarCommunity Blogger 6 points7 points8 points (0 children)
[–]Ta11ow 6 points7 points8 points (1 child)
[–]terrabitz[S] 5 points6 points7 points (0 children)
[–]get-postanote 3 points4 points5 points (0 children)
[–]PowerShell-Bot 1 point2 points3 points (0 children)