Exemple #1
0
 public static void PerformBonusCalculation(Employee person)
 {
     // This method uses the delegate stored in the person object
     // to perform the calculation.
     // Note: This method knows about the multiplier local variable, even though
     // that variable is outside the scope of this method.
     // The multipler varaible is a "captured outer variable".
     person.bonus = person.calculation_algorithm(person.sales);
 }
 public static void PerformBonusCalculation(Employee person)
 {
     // This method uses the delegate stored in the person object
     // to perform the calculation.
     // Note: This method knows about the multiplier local variable, even though
     // that variable is outside the scope of this method.
     // The multipler varaible is a "captured outer variable".
     person.bonus = person.calculation_algorithm(person.sales);
 }
Exemple #3
0
 public static void PerformBonusCalculation(Employee person)
 {
     // Этот метод применяет делегата, сохраненного в персональном объекте,
     // для выполнения расчета.
     // Примечание: этому методу известна локальная переменная коэффициента, несмотря на то, что
     // переменная находится вне области действия метода.
     // Переменная коэффициента -- это "зафиксированная внешняя переменная".
     person.bonus = person.calculation_algorithm(person.sales);
 }
 public static void PerformBonusCalculation(Employee person)
 {
     // 此方法使用存储在 person 对象中的委托
     // 来进行计算。
     // 注意: 此方法能够识别乘数局部变量,尽管
     // 该变量在此方法的范围之外。
     //该乘数变量是一个“捕获的外部变量”。
     person.bonus = person.calculation_algorithm(person.sales);
 }