 <p>You could use a dictionary with a key that indicates your command and an anonymous method that holds the to be executed command. For performance you better refactor the Dictionary to be static and only instantiated once but this gives you the general idea.</p> <pre><code>void Engine_SpeechRecognized (object sender, SpeechRecognizedEventsArgs e) { var commands = new Dictionary&lt;string, Action&lt;string&gt;&gt;(); commands.Add( "search google", (arg) =&gt; { Search(arg); }) ; commands.Add( "open application", (arg) =&gt; { OpenApp( "https://www.google.com/#q=" + arg); }) ; foreach(var command in commands.Keys) { if (e.Result.Text.StartsWith(command)) { Action(command, e.Result.Text, commands[command]); } } } /* helper for getting one point for an arguments extractor */ static void Action(string cmd,string all, Action&lt;string&gt; act) { string args = all.Replace(cmd,""); act(args); } </code></pre>