コード例 #1
0
ファイル: Car.cs プロジェクト: mjquito/sandbox_csharp
 // 3) Add registration function for the caller.
 //public void RegisterWithCarEngine(CarEngineHanlder methodToCall) {
 //    listOfHandlers = methodToCall;
 //}
 //    Now with multicasting support!
 //    Note we are now using the += operator, not
 //    the assignment operator(=).
 public void RegisterWithCarEngine(CarEngineHanlder methodToCall)
 {
     // This provides the registration
     listOfHandlers += methodToCall; // This is actuall calling the Delegate.Combine() method
 }
コード例 #2
0
ファイル: Car.cs プロジェクト: mjquito/sandbox_csharp
 // Remove methods from the delegate's object
 public void UnRegisterWithCarEngine(CarEngineHanlder methodToCall)
 {
     listOfHandlers -= methodToCall;
 }