Attribute.GetCustomAttribute() 返回为null 本帖最后由 u011990549 于 2014-05-14 21:49:18 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 LastModifiedAttribute只能修饰到类和方法,而不能修饰到assembly。因此,Attribute.GetCustomAttribute(Assembly, Type)不能得到任何东西。要得到Vector类的LastModified,可以:Type vectorType = theAssembly.GetType("VectorClass.Vector");Attribute modifiedAttibute = vectorType.GetCustomAttributes(false).OfType<LastModifiedAttribute>().FirstOrDefault();要得到assembly的attribute,可以:1、目标assembly要有特性标志:[assembly:SupportWhatsNew]2、获得assembly级别的特性:Attribute whatsNew = Attribute.GetCustomAttribute(theAssembly, typeof(SupportWhatsNewAttribute)) Process 运行外部程序的问题 C# UDP问题 C#类继承问题. c#重绘控件的问题。如何重绘一个statusBar的颜色。?? panel和form尺寸一致的问题 RealProducer 制作即时广播即时广播失败 一个初学者的疑惑 求答 请告诉一个crystal report 的license key 马上给分 求助银行填单机方案 【.net4自带chart控件】怎么呈现甘特图???winform .net 2.0 保护软件用DNGuard好还是Themida好?谢谢。
因此,Attribute.GetCustomAttribute(Assembly, Type)不能得到任何东西。要得到Vector类的LastModified,可以:
Type vectorType = theAssembly.GetType("VectorClass.Vector");
Attribute modifiedAttibute = vectorType.GetCustomAttributes(false).OfType<LastModifiedAttribute>().FirstOrDefault();要得到assembly的attribute,可以:
1、目标assembly要有特性标志:
[assembly:SupportWhatsNew]2、获得assembly级别的特性:
Attribute whatsNew = Attribute.GetCustomAttribute(theAssembly, typeof(SupportWhatsNewAttribute))