-1
我有像下面的代码。它使用读取用户输入作为表名,然后获取输入的类属性信息库作为类类型。问题是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',是一个自定义类的完全限定命名空间? – Sayse 2014-09-22 13:59:06