Click here to Skip to main content
16,007,885 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cryptographic question Pin
DaveyM6913-Feb-08 3:51
professionalDaveyM6913-Feb-08 3:51 
GeneralRe: Cryptographic question Pin
Todor A Kolev13-Feb-08 3:57
Todor A Kolev13-Feb-08 3:57 
GeneralRe: Cryptographic question Pin
DaveyM6913-Feb-08 4:03
professionalDaveyM6913-Feb-08 4:03 
GeneralRe: Cryptographic question Pin
User 665813-Feb-08 4:35
User 665813-Feb-08 4:35 
GeneralRe: Cryptographic question Pin
Todor A Kolev13-Feb-08 20:07
Todor A Kolev13-Feb-08 20:07 
GeneralRe: Cryptographic question Pin
Mark Churchill14-Feb-08 1:18
Mark Churchill14-Feb-08 1:18 
GeneralPerforming method of a class contained in a generic list without foreach Pin
DaveyM6913-Feb-08 3:28
professionalDaveyM6913-Feb-08 3:28 
GeneralRe: Performing method of a class contained in a generic list without foreach Pin
Judah Gabriel Himango13-Feb-08 8:40
sponsorJudah Gabriel Himango13-Feb-08 8:40 
First, the performance gains by using FindAll or Find instead of a foreach are probably minimal, and not worth rewriting swaths of code. That said, you should use LINQ to imrpove readability of code. Also, the declarative nature of LINQ opens the door for real optimizations like PLINQ[^].

To answer your question, couple ways you can do this:

var listViewItems = from movie in dvds 
                    where movie.ID > 0 
                    select movie.ToCustomListViewItem();
That uses LINQ extension methods and should work just fine.

Another way is to use methods on your List<T> object itself:

List<DVD> dvdsWithPositiveId = dvds.FindAll(movie => movie.ID > 0);
List<CustomListViewItem> listViewItems = dvdsWithPositiveId.ConvertAll(movie => movie.ToCustomListViewItem());









Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Upon this disciple I'll build my new religion?
The apostle Paul, modernly speaking: Epistles of Paul

Judah Himango


GeneralRe: Performing method of a class contained in a generic list without foreach Pin
DaveyM6913-Feb-08 9:12
professionalDaveyM6913-Feb-08 9:12 
GeneralRe: Performing method of a class contained in a generic list without foreach Pin
Judah Gabriel Himango13-Feb-08 11:38
sponsorJudah Gabriel Himango13-Feb-08 11:38 
GeneralRe: Performing method of a class contained in a generic list without foreach Pin
DaveyM6913-Feb-08 12:18
professionalDaveyM6913-Feb-08 12:18 
GeneralRe: Performing method of a class contained in a generic list without foreach [modified] Pin
DaveyM6913-Feb-08 12:30
professionalDaveyM6913-Feb-08 12:30 
GeneralRe: Performing method of a class contained in a generic list without foreach Pin
Judah Gabriel Himango14-Feb-08 4:30
sponsorJudah Gabriel Himango14-Feb-08 4:30 
QuestionWPF RichTextBox Formatted Data Sent to Access Database Pin
Thomas Stockwell13-Feb-08 3:28
professionalThomas Stockwell13-Feb-08 3:28 
GeneralRe: WPF RichTextBox Formatted Data Sent to Access Database Pin
Giorgi Dalakishvili13-Feb-08 4:05
mentorGiorgi Dalakishvili13-Feb-08 4:05 
GeneralRe: WPF RichTextBox Formatted Data Sent to Access Database Pin
Thomas Stockwell13-Feb-08 8:12
professionalThomas Stockwell13-Feb-08 8:12 
GeneralRe: WPF RichTextBox Formatted Data Sent to Access Database Pin
Giorgi Dalakishvili13-Feb-08 8:51
mentorGiorgi Dalakishvili13-Feb-08 8:51 
GeneralRe: WPF RichTextBox Formatted Data Sent to Access Database Pin
Thomas Stockwell13-Feb-08 13:00
professionalThomas Stockwell13-Feb-08 13:00 
Generalthread Pin
248912813-Feb-08 2:58
248912813-Feb-08 2:58 
GeneralRe: thread Pin
Not Active13-Feb-08 3:12
mentorNot Active13-Feb-08 3:12 
GeneralRe: thread Pin
Bekjong13-Feb-08 3:19
Bekjong13-Feb-08 3:19 
GeneralRe: thread Pin
Spacix One13-Feb-08 5:08
Spacix One13-Feb-08 5:08 
GeneralAbnormal thread results Pin
Yoyosch13-Feb-08 2:21
Yoyosch13-Feb-08 2:21 
GeneralRe: Abnormal thread results Pin
Bekjong13-Feb-08 3:01
Bekjong13-Feb-08 3:01 
GeneralRe: Abnormal thread results Pin
CKnig13-Feb-08 3:02
CKnig13-Feb-08 3:02 

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.