![](/img/trans.png)
[英]What is the .Net core equivalent of KerberosRequestorSecurityToken?
[英]What's the equivalent for getting the list of constructors in .NET Standard / Core?
我正在尝试将我的.NET 4项目升级到.NETStandard和Core,但无法找到相应的: -
var ctors = typeof(T).GetConstructors();
GetConstructors是反思的一部分,所以看起来支持是故意缺乏或移动的......
谢谢。 西蒙。
在.NET标准/核心中,很多reflexion api被移动到特定的包(system.reflection)。 此包在Type类上提供了扩展方法GetTypeInfo
。
typeof(T).GetTypeInfo().DeclaredConstructors;
这很简单 - 只需添加GetTypeInfo()
:
var ctors = typeof(T).GetTypeInfo().DeclaredConstructors();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.