Throw string as exception
#include "stdafx.h" using namespace System; public ref class MyClass { public: static void TrySomething() { throw gcnew String("Error that throws string!"); } }; int main() { try { MyClass::TrySomething(); } catch(String^ s) { Console::WriteLine(s); } }