Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, although ports exist for Java, PHP, JavaScript and ActionScript.

learn more… | top users | synonyms

58
votes
12answers
6k views

Why is the use of abstractions (such as LINQ) so taboo?

I am an independent contractor and, as such, I interview 3-4 times a year for new gigs. I am in the midst of that cycle now and got turned down for an opportunity even though I felt like the ...
43
votes
5answers
16k views

for vs. foreach vs. LINQ

When I write code in Visual Studio, ReSharper (God bless it!) often suggests me to change my old-school for loop in the more compact foreach form. And often, when I accept this change, ReSharper goes ...
33
votes
9answers
8k views

Does the usage of LINQ and Lambda Expressions lead to less readable code?

I'm having a discussion with a co-worker on Linq, I'll copy here: Co-Worker: Lets be honest here. Linq syntax sucks. It's confusing and non-intuitive. Me: oh come on, more confusing ...
18
votes
5answers
2k views

MVC, WCF, EF, LINQ - Is it just me? [closed]

...or are things getting more complicated? It seems to me that you need to know a lot of stuff to 'properly' develop an MS web app these days. In the bad old days when we didn't know any better we ...
15
votes
8answers
12k views

Senior Interview LINQ questions [closed]

I'm preparing a LINQ section in interview questions for senior programmers. What are the most interesting questions in LINQ to include? And why?
14
votes
7answers
11k views

What's the best Java equivalent to Linq? [closed]

Are there any libraries in Java that come close to providing the functionality of Linq?
12
votes
5answers
4k views

Is the potential performance hit from LINQ worth it for improved readability?

We are considering using LINQ (to Objects) in our (commercial grade) projects where performance may be an issue. I have heard it may impact performance, but then the code is so much more readable and ...
12
votes
4answers
969 views

Is linq more efficient than it appears on the surface?

If I write something like this: var things = mythings .Where(x => x.IsSomeValue) .Where(y => y.IsSomeOtherValue) Is this the same as: var results1 = new List<Thing>(); ...
12
votes
4answers
1k views

What would you think about a new Java persistence tool, that's not really an ORM? [closed]

Persistence in Java Over the past years, I have gathered experience in the field of persistence abstraction in Java, using concepts such as EJB 2.0, Hibernate, JPA and home-grown ones. They seemed to ...
11
votes
3answers
1k views

What problem domain is LINQ made for?

Each time I see a question posted on Stack Overflow on C#, I see at least one or two answers posted that solve a problem with LINQ. Usually people with very high reputation seem to use LINQ like pros. ...
10
votes
9answers
2k views

LINQ Style preference [closed]

I have come to use LINQ in my every day programming a lot. In fact, I rarely, if ever, use an explicit loop. I have, however, found that I don't use the SQL like syntax anymore. I just use the ...
9
votes
5answers
2k views

LINQPad still being used much out there? [closed]

I'm trying to guage how popular and how used LINQPad is today. I'm just wondering if it's still a useful tool or not as VS and other tools have gotten better. Furthermore, I am coding over LLBGen by ...
9
votes
6answers
814 views

As a new programmer, how much time should I spend learning new libraries?

As a junior programmer, how much time should I spend focusing on new libraries or language features, as opposed to learning how things worked before those libraries came about? How dangerous is it to ...
7
votes
5answers
1k views

XSLT and possible alternatives [closed]

I had a look at XSLT for transforming one XML file into another one (HTML, etc.). Now while I see that there are benefits to XSLT (being a standardized and used tool) I am reluctant for a couple of ...
7
votes
4answers
2k views

LINQ vs Data Access Layer

I've taught myself always to handle any data access code in a completely separate 'layer' to my business logic and UI code. This has always been a very good architecture for me and any 'rules' or best ...
7
votes
3answers
5k views

In ASP.NET MVC3 controllers, where do you instantiate your DataContext?

In your ASP.NET MVC 3 applications that use a DataContext or DbContext, where do you instantiate your data access object? Here is a non-exhaustive list of where I've seen it done: Individually ...
7
votes
2answers
1k views

Does LINQ require significantly more processing cycles and memory than lower-level data iteration techniques?

Background I am recently in the process of enduring grueling tech interviews for positions that use the .NET stack, some of which include silly questions like this one, and some questions that are ...
6
votes
4answers
1k views

Best algorithm/practice when creating a search mechanism for your database? [closed]

I have been designing a database where it is very important to provide users with a good search mechanism. So I was wondering what some of the best practices are for using keywords to search over ...
5
votes
1answer
10k views

Entity Framework vs. Linq to SQL? [closed]

I'm a little bit confused about these two terms "Linq to SQL" and "Entity Framework". I have the general idea that both of them somehow allow you to refer to database tables as .net objects or ...
5
votes
3answers
1k views

Will there be any official LINQ like lambda based library for C++?

Given C++('11) has lambdas now, will there be any LINQ like higher order function library officially supported later? Is there any such library now being used in any production level code? Obviously ...
4
votes
3answers
637 views

Is LinqPad site quote “Tired of querying in antiquated SQL?” accurate?

I was struck by the heading Tired of querying in antiquated SQL? on http://www.linqpad.net/. I am a N-Tier application developer and learnt my trade in a company that worked with a lot of data, ...
4
votes
1answer
385 views

What is Rainbow (not the CMS)

I was reading this excellent blog article regarding speeding up the badge page and in the last comment the author waffles (a.k.a Sam Saffron) mentions these tools: dapper and a bunch of custom ...
4
votes
3answers
2k views

Is querying KeyValue Pairs efficient compared to two-property objects?

I'm working on a webservice and I'm returning JSON. However, I'm returning a List<KeyValuePair<string, int>>, since that's all I'm really ever going to be dealing with (property => value) ...
4
votes
1answer
1k views

Why is imperative programming preferred over functional programming? [closed]

Background: I am proponent of functional programming who works at a VB.NET shop where the prevailing mental model is imperative programming. Being that foundation of our system is WinForms I can ...
4
votes
3answers
885 views

LINQ to SQL - Business logic in another assembly?

So I am trying my hand at this whole tiered application thing with ASP.NET 4. The software I've developed is a maintenance nightmare and it isn't very well organized. I've done some looking around ...
4
votes
2answers
1k views

MVVM Reporting App Approach ? Data Access Layer?

I'm trying to follow the MVVM pattern in a reporting / statistics application that I'm making in C# / WPF. I have made many model classes to hold properties as a starting point. Some of these models ...
3
votes
1answer
285 views

Test bed application for executing LinQ queries against AdventureWorks [closed]

I am looking for a "test bed" application which will help me to learn Linq by writing queries and immediately executing them against the AdventureWorks database. Why AdventureWorks? Because it is a ...
3
votes
3answers
2k views

T-SQL stored procs orders of magnitude faster than LINQ

According to answers I've seen on stackoverflow, stored procedures (and to a lesser extent db functions) tend to perform better vs. LINQ + ORM frameworks (e.g. Entity Framework). I want to determine ...
3
votes
2answers
298 views

Extracting lambda expressions from linq queries and readability

Every now and then when I have a complex lambda, I do something like this: Func<SomeObject, bool> equals = o => o.ID == someID && o.Name == someName && IsAdd || ... var ...
3
votes
2answers
2k views

Is it better to create a stored procedure or entities to get to the data I need?

I just jumped into a new project with a new company using Entity Framework and ASP.NET MVC 4. I am no expert on Entity Framework, but I think I have a decent grasp of how to use it. From what I can ...
3
votes
5answers
278 views

Using 'new' in a projection?

I wish to project a collection from one type (Something) to another type (SomethingElse). Yes, this is a very open-eneded question, but which of the two options below do you prefer? Creating a new ...
3
votes
1answer
281 views

which sorting algorithms is using OrderBy

I am litle curious about what sorting algorithm is using OrderBy (linq to objects). quicksort? heapsort? introspective sort ? As i see in MSDN documentation List.Sort is using introspective sort: ...
3
votes
1answer
331 views

Using Dynamic LINQ to get a filter for my Web API

We are considering using the Dynamic.CS linq-sample included in the "Samples" directory of visual studio 2008 for our WebAPI project to allow clients to query our data. The interface would be ...
3
votes
1answer
278 views

Algorithm to optimize grouping

I would like to know if there's a known algorithm or best practice way to do the following: I have a collection with a subcollection, for example: R1 R2 R3 -- -- -- M M M N N L L A What i ...
3
votes
1answer
497 views

Any changes/improvement for LINQ 2010 vs LINQ 2008

I'm VB.NET user and now learning LINQ. The book I'm reading now focus on LINQ 2008 VB.NET. I want to know whether there are changes/improvement in LINQ 2010? p/s: I'm reading this book: Pro LINQ ...
2
votes
4answers
2k views

Should I be learning Linq, Direct SQL Commands (in .net), EF or other? [closed]

Basically, I have a very good knowledge of plain old SQL coming from Classic ASP programming. Over the past couple of months, I have been learning C# and today was my first full day at MVC 3 (Razor) ...
2
votes
3answers
543 views

Optimal way to implement this specific lookup table in C#?

I want to create a lookup table for this data: The "input variables" (what is used to "lookup") are 4 different doubles that can each take on 1 of 200 numbers (the numbers range from 1-1000 but there ...
2
votes
1answer
299 views

Better way to read XML

We are storing config files as XML. With that being said, when reading the XML file, is it better to use LINQ to query the XML file or would using the XMLDocument and/or XMLNode classes better to use? ...
2
votes
2answers
324 views

Style for creating IEnumerable unions

There isn't any cool LINQ sugar for creating unions. The Enumerable.Union() method is usually called like this: var bigList = list1.Union(list2); The alternative is to call Enumerable.Union() which ...
2
votes
4answers
508 views

What is the most effective order to learn SQL Server, LINQ, and Entity Framework?

I am trying to get some advice on what order I should learn about SQL Server, LINQ, and Entity Framework to be able to better work with ASP.NET Webforms and MVC. From what I've been able to learn so ...
2
votes
4answers
222 views

Why should IQueryProvider implementations throw NotSupportedExceptions?

Searching the web, we can find plentiful examples of various ORMs (nHibernate, EF, LinqToSql, etc.) that implement but don't actually support the full IQueryable<T> interface, throwing ...
2
votes
1answer
2k views

Nesting Linq-to-Objects query within Linq-to-Entities query –what is happening under the covers?

var numbers = new int[] { 1, 2, 3, 4, 5 }; var contacts = from c in context.Contacts where c.ContactID == numbers.Max() | c.ContactID == numbers.FirstOrDefault() ...
2
votes
1answer
206 views

Are elements returned by Linq-to-Entities query streamed from the DB one at the time or are they retrieved all at once?

Are elements returned by Linq-to-Entities query streamed from the database one at the time ( as they are requested ) or are they retrieved all at once: SampleContext context = new ...
2
votes
1answer
285 views

Is it okay to convert dataset from stored procedure to IEnumerable

So, I am working on a project with a team and we are using Entity Framework. We basically want to use linq to entities, and not use stored procedures. I use quite a bit of lists and IEnumerables and ...
2
votes
1answer
595 views

Best way to remove list items from an existing record

Ok more of a conceptual question here: Say I have an existing record of type Meeting. When I go to edit the meeting I have a listbox with all current meeting participants, and one with all employees. ...
1
vote
2answers
260 views

C# Linq to <blank> which type is most used and which are most hated/unneeded

I have read and used many good Linq to . I have also read that some of the Linq to __ are not worth learning as there are better techniques. I was just wondering which of the bunch should I ...
1
vote
2answers
159 views

TDD - Making assertions about C# Expression trees

How would you unit test the PerformUpdate method in the sample below? This is a (very) simplified version of some code that performs updates against a database where the schema is dynamic and ...
1
vote
2answers
986 views

Best practice modelling an active record entity using Linq-To-SQL as DAL

Currently I'm starting a new system on my company, and we are using a good separation between models, views and controllers, basically using Asp.Net MVC 3 for the user UI, and a C# class library for ...
0
votes
3answers
494 views

Are there any good resources for refactoring existing C# code to use LINQ while keeping your tests passing?

I've been teaching myself a little LINQ and an exercise I thought would be useful was to take my existing Project Euler C# code, which I built using Test Driven Development and gradually convert it to ...
0
votes
2answers
1k views

LINQ TO SQL or ADO.NET? [closed]

What is the best choice LINQ TO SQL (.DBML) or using ADO.NET with procedures for a database with 29 tables and about 30 concurrent users that will run the system that I am going to build? I know that ...