读取自定义属性

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Tool
{
    public class CustomAttribute
    {
        public static string GetCustomAttribute<T>(Type type) where T:System.Attribute
        {
            return type.GetCustomAttributes(typeof(T), false)[0] as string;
        }
    }

posted @ 2012-05-11 17:45  szjdw  阅读(175)  评论(0编辑  收藏  举报