//Execute a plugin by name private void ExecutePlugin(string pluginName) { //create a context object to pass to the plugin //this context holds the current editor text //and the plugin might change the text as part of its work //we will then show the tranformed text EditorContext context = new EditorContext(txtText.Text); foreach(IPlugin plugin in m_plugins) { if(plugin.Name==pluginName) { plugin.PerformAction(context); txtText.Text= context.CurrentDocumentText; return; } } }