c# - Retrieve two values in the same linq query -


I am starting with linqToSql and I still have some questions in making my queries.

For example, I want to get an integer with two values, a subset of elements, and count of elements in the same query. In this way I have done it separately:

  integer elements; IEnumerable & LT; ClsTax & gt; result; Outcome = (Select new ClsTax {tax = T.TX1, increase = TNRCTs} from T. db.tax Take (25); Total Elements = (Select the new ClsTax {tax = t.tax1, increase = t.increase} from db.tax). Calculation ();  

As you can see, I can not use results.count () because I only used Tech (25) to get the first 25 elements, and I It is to know how many elements are

thanks

post text "itemprop = "Text">

How about:

  var all = (Choose from db.tax to select new claxex in te {tax = ttx1, increase = increase t}); Var calculation = all.Count (); Var results = all.Take (25);  

A little easier?


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -