说服我移动到.NET 3.5(2.0)NET

由网友(从你的世界裡路過)分享简介:我到新的桌面应用程序的开发。我觉得自己在家里用.NET 2.0和C#。我想我不需要LINQ,也不关心WPF和其他Vista的OID花哨的关键字。我也喜欢比较紧的身段2.0可再发行,更主要的原因是Vista和7包括在内。I am into new desktop app development. I feel at...

我到新的桌面应用程序的开发。我觉得自己在家里用.NET 2.0和C#。我想我不需要LINQ,也不关心WPF和其他Vista的OID花哨的关键字。我也喜欢比较紧的身段2.0可再发行,更主要的原因是Vista和7包括在内。

I am into new desktop app development. I feel at home with .NET 2.0 and c#. I guess I don't need linq, nor care for WPF and other Vista-oid fancy keywords. I also like rather tight and slim 2.0 redistributable, even more for reason it's Vista and 7 included.

为什么要切换到3.5?

Why switch to 3.5?

推荐答案

一个字:

的LINQ

一旦你使用LINQ做了一个查询你的对象,你永远不会回去。 LINQ的不仅仅是数据库,你可以有什么样的集合,如果可以的话当然preSS自己的功能,您可以更改

Once you've done a single query on your objects using Linq you'll never go back. Linq isn't just databases, you can have any kind of collection, and if you can express yourself functionally, you can change

foreach (obj in myCollection)
{
   if (obj.property == match)
   {
      foundObj = obj;
      break;
   }
}

myCollection.Single(obj => obj.property == match);

编辑:或

var foundobj = 
(from obj in myCollection
where obj.property == match)
.Single()

哪一个更有意义?那么,当你想前preSS非常复杂的查询像这样的地方,而那,从选择一些符合一些其他财产。您可以在两个函数调用做到这一点。

Which one makes more sense? What about when you want to express much more complex queries like where this and that and that, from that select the ones that match some other property. You can do it in two function calls.

很抱歉的言论,但我真的很喜欢LINQ的。

Sorry about the rant but I really do like Linq.

阅读全文

相关推荐

最新文章