将匿名类型作为ToList()传递给过程 [英] Passing Anonymous types to a Procedure as ToList()
本文介绍了将匿名类型作为ToList()传递给过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将C#与VS 2008配合使用,并正在通过教程进行操作.
我不知道如何将匿名类型列表传递给本教程中给定的方法.
具体来说,"DisplayResults"方法的过程签名应该是什么样的?我将使用DataGridView创建一个表单,以显示查询中的流程信息.
有问题的代码:
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.
推荐答案
^ ]
这篇关于将匿名类型作为ToList()传递给过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文