C++/CLI use of Action<…,…> and Func<…> unsupported?

别说谁变了你拦得住时间么 提交于 2019-12-05 13:58:38

The location of the Action and Func types is different depending on the framework version you are using.

In the 3.5 framework all definitions of Func (generic or not generic) reside in System.Core.dll. This is also true for versions of Action with 2 or more generic parameters. Action and Action<T1,T2> are in mscorlib though.

In the 4.0 framework all of the definitions of Func and Action moved to mscorlib. There are type forwarders inserted into System.Core which point back to mscorlib now.

Silverlight 4.0 is closer to the 3.5 framework solution.

Make sure you have a reference to the appropriate DLL for your solution.

The following are defined in mscorlib -

Action
Action<T>

But the following are defined in System.Core.

Action<T1, T2>
Func<T1, T2>

You're probably missing a reference to that assembly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!