Click here to Skip to main content
15,896,912 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I run adb or fastboot command in the folder location? Pin
Richard MacCutchan16-Jan-18 22:08
mveRichard MacCutchan16-Jan-18 22:08 
PraiseRe: How do I run adb or fastboot command in the folder location? Pin
Member 1362111717-Jan-18 7:36
Member 1362111717-Jan-18 7:36 
GeneralRe: How do I run adb or fastboot command in the folder location? Pin
Pete O'Hanlon17-Jan-18 8:59
mvePete O'Hanlon17-Jan-18 8:59 
GeneralRe: How do I run adb or fastboot command in the folder location? Pin
Richard MacCutchan17-Jan-18 23:26
mveRichard MacCutchan17-Jan-18 23:26 
GeneralRe: How do I run adb or fastboot command in the folder location? Pin
Member 1362111717-Jan-18 11:54
Member 1362111717-Jan-18 11:54 
QuestionError: Object reference not set to an instance of an object in C# Pin
Member 1030297116-Jan-18 13:52
Member 1030297116-Jan-18 13:52 
AnswerRe: Error: Object reference not set to an instance of an object in C# Pin
OriginalGriff16-Jan-18 21:12
mveOriginalGriff16-Jan-18 21:12 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Member 1030297117-Jan-18 2:47
Member 1030297117-Jan-18 2:47 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Pete O'Hanlon17-Jan-18 2:55
mvePete O'Hanlon17-Jan-18 2:55 
AnswerRe: Error: Object reference not set to an instance of an object in C# Pin
Ralf Meier16-Jan-18 21:14
mveRalf Meier16-Jan-18 21:14 
AnswerRe: Error: Object reference not set to an instance of an object in C# Pin
V.16-Jan-18 22:06
professionalV.16-Jan-18 22:06 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Member 1030297117-Jan-18 3:00
Member 1030297117-Jan-18 3:00 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
F-ES Sitecore17-Jan-18 4:05
professionalF-ES Sitecore17-Jan-18 4:05 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Pete O'Hanlon17-Jan-18 4:41
mvePete O'Hanlon17-Jan-18 4:41 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
V.18-Jan-18 3:25
professionalV.18-Jan-18 3:25 
QuestionException raised at wpf designer level Pin
abboudi_ammar16-Jan-18 7:35
abboudi_ammar16-Jan-18 7:35 
QuestionHow to convert a query to lambda based Pin
Mou_kol16-Jan-18 1:43
Mou_kol16-Jan-18 1:43 
AnswerRe: How to convert a query to lambda based Pin
OriginalGriff16-Jan-18 1:52
mveOriginalGriff16-Jan-18 1:52 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol16-Jan-18 3:50
Mou_kol16-Jan-18 3:50 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol24-Jan-18 0:26
Mou_kol24-Jan-18 0:26 
GeneralRe: How to convert a query to lambda based Pin
OriginalGriff24-Jan-18 0:44
mveOriginalGriff24-Jan-18 0:44 
Linq queries and Linq methods aren't executed immediately, they use something called "Deferred execution" which (basically) means that nothing is done until you actually need the final results.
There is a basic example of this here: Deferred Execution Example (C#) | Microsoft Docs[^]

Deferred execution means better efficiency (sometimes) because you can "combine operations" instead of having to loop each time to produce the intermediate result which you then pass to the next section of the evaluation. Remember: Linq isn't "no loops" it's about "hiding loops" where you can't see them and evaluating them only when it has to.

But ... when you say "ToList" you are explicitly requesting an object be created holding the whole results - so the whole operation has to be performed immediately to generate the collection you asked for. So when you then continue to process it, you need to do another loop to process the next operation.
Every time you call ToList, you make Linq work harder, and that takes both more time, and uses more memory. Only ever "Collapse the operation" when you actually need the results!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

AnswerRe: How to convert a query to lambda based Pin
Richard Deeming16-Jan-18 3:03
mveRichard Deeming16-Jan-18 3:03 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol16-Jan-18 3:50
Mou_kol16-Jan-18 3:50 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol24-Jan-18 0:35
Mou_kol24-Jan-18 0:35 
Questioncontour plot in visual studio Pin
Member 1362407415-Jan-18 6:27
Member 1362407415-Jan-18 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.