Click here to Skip to main content
13,086,019 members (82,167 online)
Rate this:
Please Sign up or sign in to vote.
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 6:20am
Updated 15-Sep-12 6:26am
Richard MacCutchan 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 15 Sep 2012
Copyright © CodeProject, 1999-2017
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