Click here to Skip to main content
Rate this: bad
good
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");
THANKS IN ADVANCE FOR YOUR CONSIDERATION.
Posted 15-Sep-12 6:20am
Edited 15-Sep-12 6:26am
v2
Comments
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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 6,745
1 OriginalGriff 6,696
2 CPallini 5,315
3 George Jonsson 3,599
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web04 | 2.8.140922.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