软件工程师在C#中有同等学历吗? [英] Do functors have an equivalent in C#?

查看:151
本文介绍了软件工程师在C#中有同等学历吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#中有Functors吗?

Is there an equivalent to Functors in C#?

C#有Func<,>,委托和匿名方法,但不是这些指针都指向一个方法?

C# has Func<,>, delegates and anonymous methods but aren't all of these pointers to a method?

C ++ Functor是一个类,不是一个方法的指针。

The C++ Functor is a class and not a pointer to a method.

推荐答案


C#有Func<,>,委托和匿名方法所有这些指向方法的指针?

否。即使C#代理是类,由编译器为您实现。这些生成的类(对于代理)派生自 MulticastDelegate ,后者又来自 委托

No. Even C# delegates are classes, implemented by the compiler for you. These generated classes (for delegates) are derived from MulticastDelegate which in turn derives from Delegate.

简而言之,委托是一个由编译器生成的类的语法糖。

In short, a delegate is a syntactic sugar for a class generated by compiler.

这篇关于软件工程师在C#中有同等学历吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆