K
K
kwayne2019-02-27 21:34:30
C++ / C#
kwayne, 2019-02-27 21:34:30

C# modular architecture. How to access stat. program class from the plugin?

Hello.
The application has a static class with fields. Fields of this class can be conveniently accessed from any other application classes.
Plug-ins-assemblies that implement the interface are connected in the application. Plugins are connected dynamically by reflection.
How can I get up-to-date information from a static class?
I would like to pass a semblance of a reference to the class once when loading the plugin assembly, and already from the plugin to have access to the actual data of the static class.
5c76d74a84ea9720267796.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
eRKa, 2019-02-27
@kwayne

If the plugin is provided with an application api, add an api through which you will give the plugin information of your static class.
Either the plugin, during initialization, must be able to receive a set of parameters from the outside, through which it will be possible to accept your options.

A
Alexander, 2019-02-27
@alexr64

Convert the static class to a singleton .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question