Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the biggest mistake people make when starting to use LINQ? [closed]

Tags:

.net

linq

What are the fundamental misunderstandings people have when they first start using LINQ?

For instance, do they think it is one thing when it is really something else?

And, are there some best practices to employ to avoid these mistakes?

like image 796
Even Mien Avatar asked Apr 22 '09 14:04

Even Mien


4 Answers

That it should be used for everything.

like image 69
Adam Robinson Avatar answered Oct 13 '22 13:10

Adam Robinson


Failing to understand the differences betweeen (or existence of!):

.First()
.FirstOrDefault()
.Single()
.SingleOrDefault()

Not understanding deferred execution.

like image 20
Richard Ev Avatar answered Oct 13 '22 15:10

Richard Ev


That it only refers to LINQ to SQL

like image 37
Scott Weinstein Avatar answered Oct 13 '22 14:10

Scott Weinstein


The biggest mistake people make when using LINQ is the same as when people try to use any sort of technology that lies on top of a technology that they don't have any good grounding in.

If you can't understand proper/efficient DB querying, you will screw up with LINQ.

If you can't understand the basic fundamentals of ADO.NET and data access, you'll probably screw up.

People think that by using LINQ it will allow them to coast by, but it won't.

like image 21
TheTXI Avatar answered Oct 13 '22 14:10

TheTXI