请关注下面的贴子
http://www.csdn.net/expert/topic/701/701403.xml?temp=.7961542

解决方案 »

  1.   

    MemberInfo.GetCustomAttrbutes由两个overload version:
    public abstract object[] GetCustomAttributes(bool inherit);
    public abstract object[] GetCustomAttributes(Type attrtype, bool inherit);调用必须加上参数(比如true, false...)。
    而且返回值也不是Attribute[],而是object[]。所以:
    foreach(object o in ...) {
         Attribute attr = o as Attribute;
         ... ...
    }