[英]How do I access Assembly Attributes in a Universal Windows App?
I'm trying to get the values from some of my assembly's attributes, for example the various version attributes plus some custom attributes. 我正在尝试从程序集的某些属性中获取值,例如各种版本属性以及一些自定义属性。
When I try to access Assembly.GetExecutingAssembly()
it's gone! 当我尝试访问
Assembly.GetExecutingAssembly()
它消失了! System.Reflection.Assembly
seems to have only one method, Load()
. System.Reflection.Assembly
似乎只有一种方法Load()
。
So how do I access my attribute values? 那么,如何访问我的属性值?
The only way I know in WinRT to retrieve the assembly is through the GetTypeInfo
extension method. 我在WinRT中知道的唯一检索程序集的方法是通过
GetTypeInfo
扩展方法。 It's defined in the namespace System.Reflection
: 它在名称空间
System.Reflection
定义:
using System.Reflection;
...
foreach (var attribute in this.GetType().GetTypeInfo().Assembly.CustomAttributes)
{
Debug.WriteLine(attribute);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.