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

C#

 
GeneralRe: Read from Byte Array Pin
DJ24528-Jun-11 23:57
DJ24528-Jun-11 23:57 
GeneralRe: Read from Byte Array Pin
lukeer29-Jun-11 0:05
lukeer29-Jun-11 0:05 
GeneralRe: Read from Byte Array Pin
DJ24529-Jun-11 0:23
DJ24529-Jun-11 0:23 
QuestionGet one type of elements from dictionary Pin
Mc_Topaz27-Jun-11 3:01
Mc_Topaz27-Jun-11 3:01 
AnswerRe: Get one type of elements from dictionary Pin
musefan27-Jun-11 3:08
musefan27-Jun-11 3:08 
GeneralRe: Get one type of elements from dictionary Pin
Mc_Topaz27-Jun-11 3:16
Mc_Topaz27-Jun-11 3:16 
GeneralRe: Get one type of elements from dictionary Pin
BobJanova27-Jun-11 3:56
BobJanova27-Jun-11 3:56 
AnswerRe: Get one type of elements from dictionary Pin
Keith Barrow27-Jun-11 3:28
professionalKeith Barrow27-Jun-11 3:28 
You cando this with LINQ

List<Bar2> bar2s =
      (from entry in foos
       where entry.Value is Bar2
       select entry.Value as Bar2).ToList();


If you don't care about the list being of Bar2, you can just do this:

var bar2s = from entry in foos
    where entry.Value is Bar2
    select entry.Value;


Not sure what the performance comparision is like, but my gut instinct is to go with the cleaner code unless I know performance is a concern.

GeneralRe: Get one type of elements from dictionary Pin
David198727-Jun-11 4:01
David198727-Jun-11 4:01 
AnswerRe: Get one type of elements from dictionary Pin
Ian Shlasko27-Jun-11 9:43
Ian Shlasko27-Jun-11 9:43 
AnswerRe: Get one type of elements from dictionary Pin
SledgeHammer0127-Jun-11 11:19
SledgeHammer0127-Jun-11 11:19 
GeneralRe: Get one type of elements from dictionary Pin
PIEBALDconsult27-Jun-11 14:39
mvePIEBALDconsult27-Jun-11 14:39 
GeneralRe: Get one type of elements from dictionary Pin
Mycroft Holmes27-Jun-11 19:40
professionalMycroft Holmes27-Jun-11 19:40 
GeneralRe: Get one type of elements from dictionary Pin
SledgeHammer0127-Jun-11 19:44
SledgeHammer0127-Jun-11 19:44 
GeneralRe: Get one type of elements from dictionary Pin
Mycroft Holmes27-Jun-11 19:49
professionalMycroft Holmes27-Jun-11 19:49 
QuestionNavigating between forms Pin
Berlus26-Jun-11 1:19
Berlus26-Jun-11 1:19 
AnswerRe: Navigating between forms Pin
Mycroft Holmes26-Jun-11 1:59
professionalMycroft Holmes26-Jun-11 1:59 
AnswerRe: Navigating between forms Pin
Not Active27-Jun-11 2:29
mentorNot Active27-Jun-11 2:29 
QuestionCustom control sometimes doesn't paint/refresh the button on it Pin
teknolog12325-Jun-11 23:13
teknolog12325-Jun-11 23:13 
AnswerRe: Custom control sometimes doesn't paint/refresh the button on it Pin
Dave Kreskowiak27-Jun-11 9:22
mveDave Kreskowiak27-Jun-11 9:22 
QuestionStarting intrupped thread again.. Pin
shivamkalra25-Jun-11 19:06
shivamkalra25-Jun-11 19:06 
AnswerRe: Starting intrupped thread again.. Pin
MicroVirus26-Jun-11 0:44
MicroVirus26-Jun-11 0:44 
QuestionNamedPipeClientStream.Connect(int) doesn't throw Exception if Form is closed. [fixed, workaround] Pin
Xmen Real 25-Jun-11 17:59
professional Xmen Real 25-Jun-11 17:59 
QuestionKnow when form loses focus? Pin
Matt U.25-Jun-11 13:30
Matt U.25-Jun-11 13:30 
AnswerRe: Know when form loses focus? Pin
Dr.Walt Fair, PE25-Jun-11 16:49
professionalDr.Walt Fair, PE25-Jun-11 16: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.