Reflection 类型.GetCustomAttributesData()未在.NET Core中定义
在.NET Core中,Reflection 类型.GetCustomAttributesData()未在.NET Core中定义,reflection,.net-core,system.reflection,Reflection,.net Core,System.reflection,在.NET Core中,Type.GetCustomAttributesData()的新等价物是什么 从.Net Framework移植项目时,我无法访问此方法。任何反射NUGET都无法使用它。这将变成Type.GetTypeInfo().Assembly.CustomAttributes。人们会看到这一点,并认为它是一个属性,类似于GetCustomAttributes()返回IEnumerable,但它返回IEnumerable,根据APIsOf.Net,该方法将在.Net Core 2.0
Type.GetCustomAttributesData()
的新等价物是什么
从.Net Framework移植项目时,我无法访问此方法。任何反射NUGET都无法使用它。这将变成
Type.GetTypeInfo().Assembly.CustomAttributes
。人们会看到这一点,并认为它是一个属性,类似于GetCustomAttributes()
返回IEnumerable
,但它返回IEnumerable
,根据APIsOf.Net
,该方法将在.Net Core 2.0,assemblySystem.Runtime,Version=4.2.0.0中可用,PublicKeyToken=b03f5f7f11d50a3a
现在,您可以在assembly
System.Reflection,Version=4.1.0.0,PublicKeyToken=b03f5f7f11d50a3a
中使用GetCustomAttributes为我提供属性
类型,而不是CustomAttributeData
类型-此类型似乎仍然在.NET Core中定义,但我找不到访问它的位置。链接不安全。谢谢你的帮助。我通过涉及System.Reflection端口的.NET Core github PR找到了我需要的东西。什么链接不安全?它们都是https…APIsOf.Net->Chrome告诉我不要使用它你点击了我提供的链接了吗?第一个是:第二个是@Dagrooms,如果您键入https://APIsOf.Net
,您可以在Chrome中打开它