Is there way to use Distinct in LINQ query syntax?

前端 未结 6 2088
余生分开走
余生分开走 2021-01-01 08:10

Is there way to rewrite:

var tbl = ds.TABLES;
var q = from c in tbl
        select c.TABLE_TYPE;
string s = \"\";
foreach (var item in q.Distinct())
{
    s          


        
6条回答
  •  悲哀的现实
    2021-01-01 09:00

    There is no Distinct() method syntax in the language integrated query syntax. The closest you could do would be to move the current call:

    var q = (from c in tbl
             select c.TABLE_TYPE).Distinct();
    

提交回复
热议问题