How can you retrieve the first three orders placed by a specific customer using LINQ

How can you retrieve the first three orders placed by a specific customer using LINQ…

can any one give linq query to top 3 orders

@jaranrikki_17

customerOrders.Where(o => o.CustomerId == customerId).Take(3).ToList()

hope its helps you

@jaranrikki_17

Datatablevaraible.AsEnumerable.take(3).CopyToDataTable

Try this

This will give first 3 rows data

If you want any other let me know

1 Like

@jaranrikki_17 ,

Could you also provide us with an example case for this scenario :

Where using the above expression has worked out :slight_smile:

@jaranrikki_17

Have tested the above query ? Which you have marked as a solution

It will not work please recheck it once

@Shiva_Nikhil

yes…!

but i have modified the query what @sai_gupta has given

i got the answer

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.