且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用LINQ从文件夹中获取文件

更新时间:2023-01-15 19:15:56


原因是作为IQueriable的LINQ查询将被编译为SQL查询.由于SQL中没有名为GetFiles的方法,因此您会收到该异常.如果在Linq查询中使用您的方法很重要,则必须使用Linq To Object而不是Linq to Sql.


希望对您有所帮助,
干杯
Hi,
The reason is that the LINQ query which is an IQueriable will be compiled to a SQL query. As there is no method in SQL named GetFiles you receive that exception. If it is important to have your method in the Linq Query then you must use Linq To Object rather than Linq to Sql.


I hope it will help,
Cheers