たまに動的にイベントを追加したり、削除したりしたいときがあります。 イベントを動的に追加・削除するには以下のクラスを利用します。 System.Delegate System.Reflection.EventInfo 面倒なのが、実際にイベントを追加したり削除したりする際です。 いくら文字列で処理が実装されているメソッド名をもっていても MethodInfoでは追加できません。一旦、該当するイベントのイベントハンドラデリゲート でラップする必要があります。 動的にデリゲートを作成するには、以下のようにします。 Delegate d = Delegate.CreateDelete(イベントハンドラのタイプ, 処理メソッドを持つオブジェクト, メソッド名もしくはMethodInfo); 上記のを組み合わせると動的にイベントを追加・削除できます。 以下サンプルです。 // vim:set ts=