c# - Linq to Entities Distinct Clause -


i want add distinct code below. cannot figure out exact syntax. in advance.

var testdates = (from o in db.fmcsa_me_test_data                  orderby o.date                     select new                  {                     requestdate = o.date                  }); 

use distinct() extension method.

note distinct() may negate existing orderby (i've noticed in linq sql), may want use orderby() method afterwards.

var testdates = (from o in db.fmcsa_me_test_data                  select new                  {                      requestdate = o.date                  }).distinct().orderby(x => x.requestdate); 

Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -