以下两种方法有什么区别?他们都返回完全相同(据我所知),所以我想知道为什么宁愿使用一个在另一个?Func <x,y>和Method(x,y)有什么区别?
有没有一种特定的情况,其中以下两种方法之一是更可取的? 或者是否有任何情况下使用func<>
比正常方法更好?
private static int addThings(int x, int y)
{
return x*y;
}
private static Func<int,int,int> addMoreThings = (x,y) =>
{
return x*y;
};
其中一种方法,另一种是变量。巨大差距。 –