本文整理汇总了C#中BinaryOp.GetInvocationList方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryOp.GetInvocationList方法的具体用法?C# BinaryOp.GetInvocationList怎么用?C# BinaryOp.GetInvocationList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryOp
的用法示例。
在下文中一共展示了BinaryOp.GetInvocationList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoProggy
void DoProggy()
{
callBack = Add;
callBack += Sub;
foreach (Delegate d in callBack.GetInvocationList())
{
Console.WriteLine("Method Name[" + d.Method + "]");
Console.WriteLine("Type Name[" + d.Target + "]");
}
// do the responsible thing :)
if(callBack != null)
{
callBack(4, 5);
}
}
示例2: Main
static void Main(string[] args)
{
#region Объявление делегатов
//Sum(10, 20);
//Mul(1, 10);
//сигнатуры методов: void (int a, int b) --> сигнатура делегата
/*BinaryOp op = new BinaryOp(Sum);
op += new BinaryOp(Sum);
op += Sum;
op += Mul;
op(1, 10);
Console.WriteLine(int.MaxValue);*/
/*Action<int, int> action = Sum;
action(10, 20);
Func<DateTime, string> func = ToString;
Console.WriteLine( func(DateTime.Now));*/
#endregion
Func<int, int, int> workItem = GetNumbers;
workItem.BeginInvoke(10, 20, ShowGetNumbersResult, null);
//c использованием Колл-Бэка
while (Console.ReadLine() != "exit"){ }
BinaryOp op = new BinaryOp(Sum);
op += Mul;
op += Sum;
Delegate[] ops = op.GetInvocationList();
for (int i = 0; i < ops.Length; i++)
{
(ops[i] as BinaryOp).BeginInvoke(1, 10, null, null);
}
}