学习LINQ [英] Learning about LINQ

查看:22
本文介绍了学习LINQ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个网站上问了很多关于LINQ.我提出的问题广泛而多样,而且背后往往没有太多背景.因此,为了巩固我在 Linq 上获得的知识,我发布了这个问题,以期在我继续了解 LINQ 时使用其他信息来维护和更新它.

One of the things I've asked a lot about on this site is LINQ. The questions I've asked have been wide and varied and often don't have much context behind them. So in an attempt to consolidate the knowledge I've acquired on Linq I'm posting this question with a view to maintaining and updating it with additional information as I continue to learn about LINQ.

我也希望它能够成为其他想要了解 LINQ 的人的有用资源.

I also hope that it will prove to be a useful resource for other people wanting to learn about LINQ.

来自 MSDN:

LINQ 项目是一个代号.NET 的扩展集包含的框架语言集成查询、设置和变换操作.它扩展了 C#和 Visual Basic 母语查询语法和提供类图书馆利用这些能力.

The LINQ Project is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.

这意味着 LINQ 提供了一种使用通用语法查询各种数据源的标准方法.

What this means is that LINQ provides a standard way to query a variety of datasources using a common syntax.

目前微软提供了几种不同的 LINQ 提供程序:

Currently there are a few different LINQ providers provided by Microsoft:

  • Linq to Objects which allows you to execute queries on any IEnumerable object.
  • Linq to SQL which allows you to execute queries against a database in an object oriented manner.
  • Linq to XML which allows you to query, load, validate, serialize and manipulate XML documents.
  • Linq to Entities as suggested by Andrei
  • Linq to Dataset

还有很多其他的,其中很多都列在了此处.

There are quite a few others, many of which are listed here.

  • 查询多个数据源的标准化方式
  • 查询的编译时安全
  • 对内存对象执行基于集合的操作的优化方法
  • 能够调试查询

Chook 提供了一种输出 CSV 文件
Jeff 展示了如何从数组中删除重复项
Bob 得到一个 来自数据表的不同有序列表
Marxidad 展示了如何对数组进行排序
Dana 获得帮助实施 使用 Linq 的快速排序

Chook provides a way to output CSV files
Jeff shows how to remove duplicates from an array
Bob gets a distinct ordered list from a datatable
Marxidad shows how to sort an array
Dana gets help implementing a Quick Sort Using Linq

来自GateKiller 的问题的链接摘要如下:
Scott Guthrie 提供了一个 介绍在他的博客上访问 Linq
MSDN 上的 LINQ

ChrisAnnODell 建议查看:

ChrisAnnODell suggests checking out:

Linq 目前在 VB.Net 9.0 和 C# 3.0 中可用,因此您需要 Visual Studio 2008 或更高版本才能获得全部优势.(您可以随时在记事本中编写代码并使用 MSBuild 进行编译)

Linq is currently available in VB.Net 9.0 and C# 3.0 so you'll need Visual Studio 2008 or greater to get the full benefits. (You could always write your code in notepad and compile using MSBuild)

还有一个工具叫做LinqBridge这将允许您在 C# 2.0 中像查询一样运行 Linq.

There is also a tool called LinqBridge which will allow you to run Linq like queries in C# 2.0.

这个问题有一些使用 LINQ 的技巧>

This question has some tricky ways to use LINQ

推荐答案

LINQ to entity:

LINQ to entities:

我在 Delicious.com 上标记了很多.

I've got a lot more I tagged on Delicious.com.

这篇关于学习LINQ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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