Recently cooperate with a Taiwan university lab. They use C++ to code a core library for our .NET developers to use. Here is how to throw a .NET exception in C++/CLI

public:
	int divide(int a, int b)
	{
		if(b==0)
		   throw gcnew System::Exception("It is a C++\CLI exception, can not divided by zero");
	}
Advertisements