linq资料(收集)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
LINQ中文学习资料LINQ 随身参考手册,其中LINQ 随身参考手册是英文版的,但内容不错。 LINQ 随身参考手册介绍:   Ready to take advantage of LINQ with C# 3.0? This guide has the detail you need to grasp Microsoft’s new querying technology, and concise explanations to help you learn it quickly. And once you begin to apply LINQ, the book serves as an on-the-job reference when you need immediate reminders. All the examples in the LINQ Pocket Reference are preloaded into LINQPad, the highly praised utility that lets you work with LINQ interactively. Created by the authors and free to download, LINQPad will not only help you learn LINQ, it will have you thinking in LINQ. This reference explains: LINQ’s key concepts, such as deferred execution, iterator chaining, and type inference in lambda expressions The differences between local and interpreted queries C# 3.0′s query syntax in detail-including multiple generators, joining, grouping, query continuations, and more Query syntax versus lambda syntax, and mixed syntax queries Composition and projection strategies for complex queries All of LINQ’s 40-plus query operators How to write efficient LINQ to SQL queries How to build expression trees from scratch All of LINQ to XML’s types and their advanced useLINQ promises to be the locus of a thriving ecosystem for many years to come. This small book gives you a huge head start. “The authors built a tool (LINQPad) that lets you experiment with LINQ interactively in a way that the designers of LINQ themselves don’t support, and the tool has all kinds of wonderful features that LINQ, SQL and Regular Expression programmers alike will want to use regularly long after they’ve read the book.” -Chris Sells, Connected Systems Program Manager, Microsoft   About the Author   Joseph Albahari is a core C# design architect at Egton Medical Information Systems, the largest primary healthcare software supplier in the UK. He has been developing large-scale enterprise applications on .NET and other platforms for more than 15 years, working in medical, telecommunication and education industries. Joseph specializes in writing custom components and controls, and has designed application component frameworks for three companies.   Ben Albahari is currently involved in the bioinformatics business. He was a Program Manager at Microsoft for 5 years, where he worked on several projects, including the .NET Compact Framework and ADO.NET.   He was the cofounder of Genamics, a provider of tools for C# and J++ programmers, as well as software for DNA and protein sequence analysis. He is a co-author of C# Essentials, the first C# book from O’Reilly, and of previous editions of C# in a Nutshell.
在C#中使用LINQ进行分组(group by)操作有多种方式。引用和引用展示了两种常见的方法。 第一种方法是使用LINQ查询表达式。在查询表达式中,我们可以使用`group by`子句来指定要分组的属性,然后使用`into`子句将结果存储在一个临时变量中。下面是一个示例: ```csharp var results = from p in persons group p.car by p.PersonId into g select new { PersonId = g.Key, Cars = g.ToList() }; ``` 在这个示例中,我们将`persons`集合按照`PersonId`属性进行分组,并将每个分组的`car`属性收集到一个列表中。结果将包含每个分组的`PersonId`和对应的`Cars`列表。 第二种方法是使用LINQ的函数形式。在函数形式中,我们可以使用`GroupBy`方法,该方法接受三个参数:分组的属性、分组的元素和一个选择器函数。此外,我们还需要使用`ToList`方法将结果转换为列表。下面是一个示例: ```csharp var results = persons.GroupBy(p => p.PersonId, p => p.car, (key, g) => new { PersonId = key, Cars = g.ToList() }); ``` 这个示例与前面的查询表达式示例的功能相同。我们通过`PersonId`属性进行分组,将每个分组的`car`属性收集到一个列表中,并创建一个包含`PersonId`和`Cars`属性的匿名对象。 总而言之,以上就是在C#中使用LINQ进行分组操作的两种常见方法。您可以根据个人喜好和项目需求选择适合的方法。引用提供了更多关于C#中使用LINQ的`GroupBy`操作的详细信息和示例,供您进一步了解和学习。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [C#Linq中的GroupBy](https://blog.csdn.net/q__y__L/article/details/125997669)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [C#在LINQ中使用GroupBy](https://download.csdn.net/download/weixin_38610717/12721697)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值