How to inherit from an abstract base class written in C# How to inherit from an abstract base class written in C# python python

How to inherit from an abstract base class written in C#


You cannot create a new instance of an abstract class in C#. that said, Python will require you to use the register, as it will not allow you to use your inherited class without registering it, unless you instantiate it.

if you want to inherit from an C# abstract class in python, you will have to write on your own the representation of register class in python at your C# class, thus will register your abstract call and be able to inherit from it.

I would suggest this site to easily help you convert between the codes if need to:

https://www.varycode.com/converter.html


I'm totally not familiar with pythonnet (or python in general for that matter), but I'm curious if something like this might work:

import clrimport abcfrom PythonAbstractBaseClass import Doorclass DoorWrapper(Door):    __metaclass__ = abc.ABCMetaclass StringDoor(DoorWrapper):  ...class BooleanDoor(DoorWrapper):  ...DoorWrapper.register(StringDoor)DoorWrapper.register(BooleanDoor)