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);
}
foreach (FieldInfo fi in t.GetFields())
{
Response.Write(fi.Name);
}
解决方案 »
- 关于自定义的基页问题
- treeview 获取节点问题
- textbox 的 onchange事件 不见了,请帮助。
- windows.open() 和 window.showModalDialog ()区别是什么
- WebService部署的后连接数据库出错
- 大家帮我看看。这个网页的功能怎么实现的。
- DataGrid复选框问题,很急啊,分数不够可以另外加,急求救.
- http://www.lybh.com/s/TreeViewDataSet.aspx 点击加号出现错误(100分)
- 引用ID的问题!!!急!!!
- 关于提问
- 编译时,未能将临时文件复制到输出目录中。这是为什么?
- 在线等待asp.net+vb.net access问题!!
实际上你要赋予它语意是没有意义的。
(它是方法实现的细节,屏蔽它的语意不止是实现的需要,而且是性能的需要)
(当然如果用JScript等有nested函数的就除外,因为nested函数还要通过名字访问它)类的成员,方法的参数的名称则有意义。
这些你都可以通过反射来访问它。如果你要在方法内使用有名字的变量,那么你可以用Hashtable.
class a
{
private string _name
private string _textproperty name()
{ get..
set..
}property text()
{ get..
set..
}}
楼主走火入魔了吧