Click here to Skip to main content
15,914,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: Custom Event Handler Problem. Pin
hdv2129-Feb-08 8:10
hdv2129-Feb-08 8:10 
GeneralGPS Data String Pin
Simerjots9-Feb-08 5:29
Simerjots9-Feb-08 5:29 
GeneralRe: GPS Data String Pin
pmarfleet9-Feb-08 7:20
pmarfleet9-Feb-08 7:20 
GeneralRe: GPS Data String Pin
Ed.Poore9-Feb-08 10:25
Ed.Poore9-Feb-08 10:25 
GeneralRe: GPS Data String Pin
Mark Churchill9-Feb-08 14:34
Mark Churchill9-Feb-08 14:34 
QuestionStatic function explained Pin
steve_rm9-Feb-08 2:38
steve_rm9-Feb-08 2:38 
GeneralRe: Static function explained Pin
Not Active9-Feb-08 2:42
mentorNot Active9-Feb-08 2:42 
GeneralRe: Static function explained Pin
DeveshKumar9-Feb-08 5:10
DeveshKumar9-Feb-08 5:10 
GeneralRe: Static function explained Pin
Pete O'Hanlon9-Feb-08 9:29
mvePete O'Hanlon9-Feb-08 9:29 
GeneralLinq query vs foreach loop [modified] Pin
DaveyM699-Feb-08 1:13
professionalDaveyM699-Feb-08 1:13 
GeneralRe: Linq query vs foreach loop Pin
That's Aragon9-Feb-08 1:30
That's Aragon9-Feb-08 1:30 
GeneralRe: Linq query vs foreach loop Pin
Daniel Grunwald9-Feb-08 2:27
Daniel Grunwald9-Feb-08 2:27 
GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 3:04
professionalDaveyM699-Feb-08 3:04 
GeneralRe: Linq query vs foreach loop Pin
Gareth H9-Feb-08 1:31
Gareth H9-Feb-08 1:31 
GeneralRe: Linq query vs foreach loop Pin
Daniel Grunwald9-Feb-08 2:36
Daniel Grunwald9-Feb-08 2:36 
GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 3:03
professionalDaveyM699-Feb-08 3:03 
GeneralRe: Linq query vs foreach loop Pin
WillemM9-Feb-08 7:54
WillemM9-Feb-08 7:54 
One of the reasons that you would use LINQ is that it allows you to write simpler code.
You query for the DVD could be a lot shorter.

public string GetName(int ID)
{
return this.Where(d => d.ID == id).Select(d => d.Name).FirstOrDefault() ?? String.Empty;
}

This is acually quite efficient, as the linq operator doesn't copy any data, but uses chained yield return methods to find the required subset of dvd's. So Link is actually just as efficient as your code would be, with the added advantage of a simple query language.

WM.

What about weapons of mass-construction?

"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog

GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 8:29
professionalDaveyM699-Feb-08 8:29 
GeneralRe: Linq query vs foreach loop Pin
Guffa9-Feb-08 8:30
Guffa9-Feb-08 8:30 
GeneralRe: Linq query vs foreach loop Pin
DaveyM699-Feb-08 8:44
professionalDaveyM699-Feb-08 8:44 
GeneralRe: Linq query vs foreach loop Pin
Guffa9-Feb-08 11:40
Guffa9-Feb-08 11:40 
GeneralRe: Linq query vs foreach loop Pin
Guffa13-Feb-08 8:19
Guffa13-Feb-08 8:19 
QuestionDocument scanning in C# Pin
Member 26713148-Feb-08 23:27
Member 26713148-Feb-08 23:27 
GeneralRe: Document scanning in C# Pin
Gareth H9-Feb-08 1:33
Gareth H9-Feb-08 1:33 
GeneralRe: Document scanning in C# Pin
Thomas Stockwell9-Feb-08 2:49
professionalThomas Stockwell9-Feb-08 2:49 

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.