Accessing .net Plugin properties (C# only) from Host (C#)

Hi Remobjects,

i am working in the .net world only using c#.

If a add the following attributes to my c# visual plugin:

[Plugin(Description=“Plugin description”, UserData=“User defined data”), VisualPlugin]
public partial class Plugin1 : VisualPlugin
{
public Plugin1()
{
InitializeComponent();
}
}

Can you provide an example how to retrieve these attributes for each plugin from inside the host .,

KR

CBL

When you load the plugin you can access its type info (including attributes) using code like

            var attributes = fCurrentPlugin.GetType().GetCustomAttributes(false);
            foreach (var item in attributes)
            {
                System.Diagnostics.Debug.WriteLine(item.ToString());
                if (item is RemObjects.Hydra.PluginAttribute)
                {
                    var attribute = item as RemObjects.Hydra.PluginAttribute;
                    System.Diagnostics.Debug.WriteLine(attribute.Name);
                    System.Diagnostics.Debug.WriteLine(attribute.Description);
                    System.Diagnostics.Debug.WriteLine(attribute.UserData);
                }
            }

Here fCurrentPlugin is a plugin instance loaded via ModuleManager.