Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VS2008 C#
I am using C# with VS 2008 and am working through a tutorial.
I don't know how to pass an anonymous type list to a method as given in the tutorial.
Specifically, what should the "DisplayResults" method's procedure signature look like? I will create a form with a DataGridView to display the processes info from the query.
The code in question:
var processes = Process.GetProcesses()
    .Where(proc => proc.Threads.Count > 10)
    .OrderBy(proc => proc.Threads.Count)
    .ThenBy(proc => proc.ProcessName)
    .Select(proc => new 
        ProcessName = proc.ProcessName,
        WorkingSet = proc.WorkingSet64,
        ThreadCount = proc.Threads.Count
// TUTORIAL PASSES processes.ToList() 
DisplayResults(processes.ToList(), "List Processes");
Posted 15-Sep-12 7:20am
Edited 15-Sep-12 7:26am
Richard MacCutchan at 15-Sep-12 12:28pm
You already have the signature as shown above: the first parameter is (presumably) a List and the second is a string. If you are not sure then you can check MSDN to see what form of List is being supplied.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,215
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,514

Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 15 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100