在物联网的.NET Framework 4,每个程序员都应该知道 [英] Things in .NET Framework 4 that every programmer should know

查看:104
本文介绍了在物联网的.NET Framework 4,每个程序员都应该知道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近搬到了Visual Studio 2010和升级我的网站的.NET Framework 4(从VS 2008 - 框架3.5)工作

I recently moved to Visual Studio 2010 and upgraded my website to work with .NET Framework 4. (From VS 2008 - Framework 3.5)

有什么事情,我需要知道,以提高网站的速度,可读性和内存使用?

What are things I need to know to improve site speed, readability or memory use?

推荐答案

Parallel.For(0,10,(i)=>
{
    // Do stuff in parallel.
});

并行该类的其余部分提供了其它一些伟大的事情如 Parallel.Invoke(...) Parallel.ForEach(...)

The rest of the Parallel class provides some other great things like Parallel.Invoke(...) and Parallel.ForEach(...).

此外,如果你做任何事情,使用LINQ,您可以使用<一个href="http://msdn.microsoft.com/en-us/library/system.linq.parallelenumerable.asparallel.aspx">ParallelEnumerable.AsParallel()法转换您的LINQ查询并行运行。

Also, if you do anything with Linq, you can use the ParallelEnumerable.AsParallel() Method to convert your Linq queries to run in parallel.

这一切都建立在href="http://msdn.microsoft.com/en-us/library/dd460717.aspx">任务并行库它提供了极大的API集的工作的

It's all built on the Task Parallel Library which provides a great set of API's for working with tasks in an abstracted way that scales for whatever resources your machine has without having to think too much about exactly how many threads you are creating.

这篇关于在物联网的.NET Framework 4,每个程序员都应该知道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆