加载到dataset里面 然后就可以得到属性的值了

解决方案 »

  1.   

    use Reflection, for example:using System;
    using System.Reflection;
    using System.ComponentModel;public class test
    {
      private int _a;
      [CategoryAttribute("背景")]
      public int a
      {get{return _a;}
       set{_a=value;}
      }  static void Main()
      {
    Type t = typeof(test);
    PropertyInfo pi = t.GetProperty("a");
    if (pi != null)
    {
    object[] atts = pi.GetCustomAttributes(true);
    if (atts.Length > 0)
    {
    foreach (object at in atts)
    {
    if (at is CategoryAttribute)
    Console.WriteLine(((CategoryAttribute)at).Category);
    }
    }
    }
      }
    }