C#出错。无法从System.Data.DataRow隐式转换为DataRow

C#出错。无法从System.Data.DataRow隐式转换为DataRow,c#,implicit,datarow,C#,Implicit,Datarow,我得到了这个错误 "Error 8 Cannot implicitly convert type 'System.Collections.Generic.List<System.Data.DataRow>' to 'System.Collections.Generic.List<DataRow>' “错误8无法将类型“System.Collections.Generic.List”隐式转换为“System.Collections.Generic.List” "

我得到了这个错误

"Error  8   Cannot implicitly convert type 'System.Collections.Generic.List<System.Data.DataRow>' to 'System.Collections.Generic.List<DataRow>'
“错误8无法将类型“System.Collections.Generic.List”隐式转换为“System.Collections.Generic.List”
"

产生问题的一行代码是

List<DataRow> dRowList = target.SearchFor(searchPhrase, searchField, matchesAny);
List dRowList=target.SearchFor(searchPhrase、searchField、matchesAny);
target.SearchFor返回数据行列表。我不知道出了什么问题。

试试这个:

List<System.Data.DataRow> dRowList = target.SearchFor(searchPhrase, searchField, matchesAny);
List dRowList=target.SearchFor(searchPhrase、searchField、matchesAny);
我假设您定义了另一个名为
DataRow
的类型,对吗?如果是这样的话,您必须明确地写下您想要使用哪一个

var dRowList = target.SearchFor(searchPhrase, searchField, matchesAny);

能否为
SearchFor
方法添加签名。谢谢。成功了!我仍然不太明白问题是什么,但现在它确实起作用了。我喜欢你的想法。我试过这个,但不管出于什么原因,它都不起作用。