[Python.NET] Re: Is it possible to check if a .NET class is a subclass of another .NET class

[email protected] Wed, 20 May 2020 06:50:08 +0200
Newsgroups gmane.comp.python.dotnet
Message-ID <CAB4CS0eWj-kPnRgCjeRRFZtYFhh3u=8eR-8pW2RkL8asismS-Q@mail.gmail.com>
--===============1266941150182760308==
Content-Type: multipart/alternative; boundary="00000000000082ae6105a60d20ad"

--00000000000082ae6105a60d20ad
Content-Type: text/plain; charset="UTF-8"

Hi, is this what you mean?

>>> import clr
>>> from System import Object
>>> from System.Collections.Generic import List
>>> List.__class__.__subclasscheck__(Object,List)
True

HTH,
Gregor


Am Mi., 20. Mai 2020 um 01:48 Uhr schrieb <[email protected]>:

> In python I can check the inheritance via isinstance() (and issubclass()).
> These methods do not work on .NET classes.
> Are there alternative methods which are doing the job for .NET
> _______________________________________________
> PythonNet mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/pythonnet.python.org/
> Member address: [email protected]
>

--00000000000082ae6105a60d20ad
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi, is this what you mean?</div><div><br></div><div s=
tyle=3D"margin-left:40px"><span style=3D"font-family:monospace">&gt;&gt;&gt=
; import clr</span></div><div style=3D"margin-left:40px"><span style=3D"fon=
t-family:monospace">&gt;&gt;&gt; from System import Object</span><br><span =
style=3D"font-family:monospace">&gt;&gt;&gt; from System.Collections.Generi=
c import List</span><br><span style=3D"font-family:monospace">&gt;&gt;&gt; =
List.__class__.__subclasscheck__(Object,List)</span><br><span style=3D"font=
-family:monospace"></span></div><div style=3D"margin-left:40px"><span style=
=3D"font-family:monospace">True</span></div><div><br></div><div>HTH,</div><=
div>Gregor</div><div><br></div></div><br><div class=3D"gmail_quote"><div di=
r=3D"ltr" class=3D"gmail_attr">Am Mi., 20. Mai 2020 um 01:48=C2=A0Uhr schri=
eb &lt;<a href=3D"mailto:[email protected]">[email protected]</=
a>&gt;:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In pytho=
n I can check the inheritance via isinstance() (and issubclass()).<br>
These methods do not work on .NET classes.<br>
Are there alternative methods which are doing the job for .NET<br>
_______________________________________________<br>
PythonNet mailing list -- <a href=3D"mailto:[email protected]" target=3D=
"_blank">[email protected]</a><br>
To unsubscribe send an email to <a href=3D"mailto:[email protected]=
g" target=3D"_blank">[email protected]</a><br>
<a href=3D"https://mail.python.org/mailman3/lists/pythonnet.python.org/" re=
l=3D"noreferrer" target=3D"_blank">https://mail.python.org/mailman3/lists/p=
ythonnet.python.org/</a><br>
Member address: <a href=3D"mailto:[email protected]" target=3D"_blank">grego=
[email protected]</a><br>
</blockquote></div>

--00000000000082ae6105a60d20ad--

--===============1266941150182760308==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
PythonNet mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/pythonnet.python.org/
Member address: [email protected]

--===============1266941150182760308==--