gpt4 book ai didi

c# - 关于委托(delegate)的问题

转载 作者:太空宇宙 更新时间:2023-11-03 19:33:39 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
C#: Difference between ‘ += anEvent’ and ‘ += new EventHandler(anEvent)’

让我们有这个委托(delegate):

delegate int Process (int x ,int y) ; 

和这个方法:

int Add (int x , int y)
{
return x+y ;
}

我的问题:

有什么区别:

Process MyProcess = Add ; 

和:

Process MyProcess = new Process (Add) ; 

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com