一个C#中delegate的使用方法实例,给新手学习一下吧。
delegatevoidFoundOperation();
classBookStore//作者A
{
FoundOperationf=newFoundOperation(otherclass.fop)//注意
publicstaticvoidMain()
{
find();
}
publicvoidfind()
{
.......
f();//通过代理调用otherclass里方法里具体实现什么本身是不知道.只知道有这个一样签名.
}
}
}
classotherclass//作者B
{
publicstaticvoidfop()
{
.....
}
} www.