if "a" is a local variable, then just forget about it, if it is a class member, use Reflectionusing System.Reflection;Type t = typeof(YourClass);
foreach (FieldInfo fi in t.GetFields())
{
  Response.Write(fi.Name);
}

解决方案 »

  1.   

    一个方法中的变量的名字只是在编程和调试时使用。
    实际上你要赋予它语意是没有意义的。
    (它是方法实现的细节,屏蔽它的语意不止是实现的需要,而且是性能的需要)
    (当然如果用JScript等有nested函数的就除外,因为nested函数还要通过名字访问它)类的成员,方法的参数的名称则有意义。
    这些你都可以通过反射来访问它。如果你要在方法内使用有名字的变量,那么你可以用Hashtable.
      

  2.   

    我觉得还是用自定义类比较方便
    class a
    {
    private  string _name 
    private  string _textproperty name()
    { get..
      set..
    }property text()
    { get..
      set..
    }}
      

  3.   

    同意Truly(小乐) 所说的
    楼主走火入魔了吧
      

  4.   

    coolpine(岁寒一友)  说的有点对