Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
.NET
»
Topic:
Delayed execution vs ToList() in LINQ Database Queries
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Delayed execution vs ToList() in LINQ Database Queries (Read 1712 times)
0 Members and 1 Guest are viewing this topic.
LE3
Guest
Delayed execution vs ToList() in LINQ Database Queries
«
on:
June 27, 2014, 09:33:18 PM »
I studied some time ago, about this, and just today found out that by mistake I forgot to use .
ToList()
on one of my queries, and suddenly our drawing generator system went into an endless loop. Then to capture or finding the bug, was tricky, but at the end was found and fixed.
So, just a reminder and here it is a good lecture about this topic, hope that helps someone else too, have fun!
http://www.ytechie.com/2009/06/delayed-execution-vs-tolist-in-linq-database-queries/
Logged
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Delayed execution vs ToList() in LINQ Database Queries
«
Reply #1 on:
June 29, 2014, 03:26:05 AM »
Thanks for the link Luis.
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
MexicanCustard
Swamp Rat
Posts: 705
Re: Delayed execution vs ToList() in LINQ Database Queries
«
Reply #2 on:
June 30, 2014, 08:43:01 AM »
If you're just ending LINQ queries with ToList() so they will execute immediately then use ToArray() instead for less overhead.
Logged
Revit 2019, AMEP 2019 64bit Win 10
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
.NET
»
Topic:
Delayed execution vs ToList() in LINQ Database Queries