【发布时间】:2014-03-24 12:45:44
【问题描述】:
我需要在 pcl Xamarin 中将类型传递给函数,然后用于执行查询。 我尝试使用的代码是这样的:
public object sqlLeggi(string sql, Type myType){
SQLiteCommand cmd = DB.CreateCommand(sql);
var results = cmd.ExecuteQuery< myType > ();
[..]
}
但它不起作用,给我这个错误:
The type or namespace 'myType' could not be found.
有谁知道是否可以做这样的事情?
非常感谢
【问题讨论】:
-
请注意,这与可移植类库、xamarin、monotouch、executequery 或 sqlite 无关。这只是
Type对象和泛型类型参数之间的混淆。
标签: sqlite xamarin.ios xamarin portable-class-library executequery