Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.

learn more… | top users | synonyms

-2
votes
1answer
19 views

groupby and return original collection using linq

I want to groupby a List<whateverType> by three of the whateverType properties, and then order it by a 4th property, and then return it as a list. How can I do this using Linq C#? The ...
0
votes
1answer
39 views

LINQ use local variable inside group by clause

This is probably really straightfoward, but I can't seem to work around it. Basically, I have a fairly complicated statement, part of which is shown below: from a in context.ALLProducts join m in ...
1
vote
1answer
29 views

Linq to sql query: how to prevent duplication of code

My problem I'm very new to Linq and I have to difficulties using it. I have written functional queries but I was forced to duplicate some code in every single query. The first part for the queries ...
0
votes
3answers
35 views

how to write the following in LINQ syntax

Just wondering how to write the following SQL in LINQ syntax select U.Id, U.FirstName, U.Surname, (select COUNT(COESNo) from COESDetails where InspectorId = U.Id) as Count from UserDetails U where ...
2
votes
2answers
66 views

Select clause null

I am currently using your = from p in (toSelect) select new { last = p.Last, current = p.CurrentPlayer, seats = from s in (p.Seated) select new { ...
0
votes
0answers
12 views

join anonymous type to Entity in LINQ to Entity

I have been learning LINQ Lamda expressions while using entity framework. But not able to find out why my code (mentioned below) is not working or is there any other way to achieve it? tbl_A is an ...
0
votes
1answer
19 views

Linq to Entities - Get list of all unique related entities

asp.net mvc 4, Entity Framework 5, SQL Server 2012 Express, Code First I have a Place model: public virtual int PlaceID { get; set; } public virtual ICollection<Tag> Tags { get; set; } public ...
2
votes
5answers
28 views

How to remove duplicates from collection using IEqualityComparer, LinQ Distinct

I am unable to remove the duplicates from collection , i have implemented IEqualityComparer for the class Employee still i am not getting the output static void Main(string[] args) { ...
0
votes
2answers
15 views

Link to xml file searching for the file in the wrong place

Hi I seem to be having some problems when working with linq to xml.When I try to load the xml file in my code it seems LINQ is looking for it in C:\Program Files (x86)\IIS Express. This is my code: ...
-1
votes
3answers
48 views

dictionary of lists in c#(cant seem to get my lists)

Here i used linq to filter my result in an array and pass into a list and from that list into a dictionary as you can see below //array is a multidimensional array with string data in it var datumn ...
0
votes
4answers
39 views

Multiple counts on single table in LINQ query

I am having trouble doing multiple counts on a single table in a LINQ query. I am using NHibernate, LINQ to NHibernate and C#. query is a populated list. I have a table that has a boolean called ...
0
votes
1answer
34 views

Linq query that returns a summary of transaction

hi i have a table which keeps track of several transactions made by several employees and these are the fields and the same employee could have made several transactions how do i write a linq query ...
1
vote
1answer
40 views

LINQ to SQL - Distinct records across multiple columns

I've got a query regarding a query I am writing in LINQ which I hope someone can help with. Basically I have the following (example data) ProductCode LanguageID LegislationId Version 1234 ...
2
votes
2answers
49 views

Remove duplicates while merging lists using Union in LINQ

I am trying to merge two lists using list.Union in LinqPad but I can't get it to work and wanted to check my understanding is correct. Given this simple class: public class Test { public int Id ...
5
votes
2answers
95 views

Calculate average with linq without grouping [duplicate]

I have a datatable, wich contains a several columns. I want to calculate the average of these with linq, without grouping: I tried this: dtPointCollFb.GroupBy(r => 1).Select(r => new { ...

1 2 3 4 5 1993
15 30 50 per page