【发布时间】:2014-11-16 12:37:37
【问题描述】:
我有如下代码。它使用读取用户输入作为表名,然后根据输入作为类类型获取类属性信息。问题是 typeof(tableName) 不正确。任何人都可以帮助我将不胜感激。
void Main()
{
var tableName = Console.ReadLine();
var propertyInfo = this.GetTableProperties(tableName);
}
public PropertyInfo[] GetTableProperties(string tableName)
{
PropertyInfo[] props = typeof(tableName).GetProperties();
return props;
}
【问题讨论】:
-
什么是
tableName,它是自定义类的全限定命名空间吗?
标签: c# reflection