I'm having a conundrum here, and I'm not even sure it's possible.
I'm developing a pluginbased application, where all the plugins will have access (read/write) to a shared configuration on the host application. There are easier ways of achieving the problem I'm presenting, but since this is a non-work related project, I'm free to play around :)
Let's say we have Plugin_A
that is inheriting a PluginBase
abstract class. The abstract class exposes a IConfiguration Config
property that can be accessed by the plugin to write to this shared configuration. The IConfiguration Config
is set properly by the host upon loading the plugin, to limit the available configuration that particular plugin will access.
What I would like to do is try and use the Dynamic keyword in C# 4.0 to seamlessly write the config-class.
in pseudo C# code here's what I would like to achieve
public class Plugin_A: PluginBase
{
public void DoSomethingWithConfig()
{
ShowAMessageBox(Config.SomeMessage);
Config.HasShownMessage = true;
}
}
Now - in this example I don't want to actually define the .SomeMessage
and .HasShownMessage
but rather have them be dynamic and returned when called upon.
It seems like a stretch, but is this at all possible?