using namespace System;

namespace Delegate
{
	ref class Hoge
	{
	public:
		event EventHandler^ Piyo;
		Hoge() { }
		void Raise() { Piyo(nullptr, EventArgs::Empty); }
	};

	ref class Program
	{
		static void Main()
		{
			Hoge^ hoge = gcnew Hoge;
			hoge->Piyo += gcnew EventHandler(&Hoge1);
			hoge->Piyo += gcnew EventHandler(&Hoge2);
			hoge->Piyo += gcnew EventHandler(&Hoge3);
			hoge->Raise();

			auto mcd = (MulticastDelegate^)hoge->Piyo;
			auto list = mcd->GetInvocationList();
		}

		static void Hoge1(Object^ sender, EventArgs^ e) { System::Diagnostics::Debug::Print("Hope1"); }
		static void Hoge2(Object^ sender, EventArgs^ e) { System::Diagnostics::Debug::Print("Hope2"); }
		static void Hoge3(Object^ sender, EventArgs^ e) { System::Diagnostics::Debug::Print("Hope3"); }
	};
}
