大家好 我有一个像这样的 LINQ 声明:
var query = from foo in NHibernate_Helper.session.Linq<TheType>() select foo;
是否可以将 TheType 存储到一个变量中以动态定义它?
提前致谢
最佳答案
这并没有完全按照您的要求进行,但是您能否使您的方法通用?
public IEnumerable<T> GetSomething<T>()
{
return (from foo in NHibernate_Helper.session.Linq<T>() select foo);
}
...
GetSomething<TheType>();
关于c# - 将列表类型定义为变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3997066/