以下是可带参数匿名方法的一个小例子
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2008
{
class DeletateParms
{
delegate int DelegateType(int x,int y,ref int z,out int m);
static DelegateType Instance()
{
return delegate(int x, int y, ref int z, out int m)
{
Console.WriteLine(string.Format("x : {0} y: {1}",x,y));
z++;
m = 9;
return z+m;
};
}
static void Main()
{
DelegateType _DelegateType = Instance();
int z=10;
int m;
Console.WriteLine(_DelegateType(3, 4, ref z, out m));
}
}
}