Adding an adapter for unsupported features
As illustrated in the previous section “C# language vs.
PowerScript language”, there are incompatible or unsupported features
when mapping the C# programming language with the PowerScript
programming language. These incompatible or unsupported features cannot
be automatically modified when importing the .NET assembly using
.NET DLL Importer. Any function using
these features will not be able to work properly after imported.
Therefore, it is recommended that you create an adapter (also
known as “wrapper”) that calls the target .NET assembly and then import
the adapter only using .NET DLL
Importer. The adapter acts as a connector between the .NET
class and the PowerScript object. You can add an adapter to deal with
unsupported features including:
-
C# enum variables — replaces them with integer
variables -
C# List — replaces it with a string-type argument
-
Complex data types or unsupported features (such as Abstract,
Interface, Static, Generic and Delegate classes, List, etc.) —
replaces them with simple data types or rewrites with supported
features
You can get a list of unsupported features in the .NET assembly by
loading it in .NET DLL Importer, and
.NET DLL Importer will show the
unsupported features after you click the View
Failed Item button at the bottom of the tool.
After you add an adapter to call the target .NET assembly, you
only need to import the adapter using .NET DLL
Importer; you do not need to import the target .NET
assembly.