This uses reflection to avoid the clerical task of adding a project reference:
System.Type t = System.Type.GetTypeFromProgID("SAPI.SpVoice"); object o = System.Activator.CreateInstance(t); t.InvokeMember("Speak", System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] { "test", 0 });
If you don’t mind adding a reference, then the whole thing can be done in one line:
new SpeechLib.SpVoice().Speak("This is a test", SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault);