using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace demo2
{
public class TestNoName
{
public delegate void test(string name);
public event test tet;
public void function(string name)
{
if(this.tet!=null)
{
tet(name);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace demo2
{
class Program
{
static void Main(string[] args)
{
TestNoName a = new TestNoName();
a.tet+=delegate(string name)
{
Console.WriteLine("{0}:我是没有方法的委托 ",name);
};
a.function("demo");
Console.ReadKey();
}
}
}