在.NET Standard/Core中获取构造函数列表的等价物是什么?

Sim*_*ies 5 c# .net-core .net-standard

我正在尝试将我的.NET 4项目升级到.NETStandard和Core,但无法找到相应的: -

        var ctors = typeof(T).GetConstructors();
Run Code Online (Sandbox Code Playgroud)

GetConstructors是反思的一部分,所以看起来支持是故意缺乏或移动的......

谢谢.西蒙.

Kal*_*ten 9

在.NET标准/核心中,很多reflexion api被移动到特定的包(system.reflection).此包提供GetTypeInfoType类的扩展方法.

typeof(T).GetTypeInfo().DeclaredConstructors;
Run Code Online (Sandbox Code Playgroud)