当前位置:网站首页>LINQ query (3)
LINQ query (3)
2022-06-25 02:11:00 【flysh05】
Internal connection Join
Check separately , Query the data and connect
var racers = from r in Formula1.GetChampions()
from y in r.Years
select new
{
Year = y,
Name = r.FirstName + " " + r.LastName
};
var teams = from t in Formula1.GetConstructorChampions()
from y in t.Years
select new
{
Year = y,
Name = t.Name
};
var racersAndTeams = (from r in racers
join t in teams on r.Year equals t.Year
select new
{
r.Year,
Champion = r.Name,
Constructor = t.Name
}).Take(10);
Merge together , Direct internal connection
var racersAndTeams = (from r in
from r1 in Formula1.GetChampions()
from yr in r1.Years
select new
{
Year = yr,
Name = r1.FirstName + " " + r1.LastName
}
join t in
from t1 in Formula1.GetConstructorChampions()
from yt in t1.Years
select new
{
Year = yt,
Name = t1.Name
}
on r.Year equals t.Year
orderby t.Year
select new
{
Year = r.Year,
Racer = r.Name,
Team = t.Name
}).Take(10);
Use method connection
var racers = Formula1.GetChampions()
.SelectMany(r => r.Years, (r1, year) =>
new
{
Year = year,
Name = $"{
r1.FirstName} {
r1.LastName}"
});
var teams = Formula1.GetConstructorChampions()
.SelectMany(t => t.Years, (t, year) =>
new
{
Year = year,
Name = t.Name
});
var racersAndTeams = racers.Join(teams,
r => r.Year,
t => t.Year,
(r, t) =>
new
{
Year = r.Year,
Champion = r.Name,
Constructor = t.Name
}).OrderBy(item => item.Year).Take(10);
边栏推荐
- 华为、阿里等大厂程序员真的好找对象吗?
- EasyCVR平台EHOME协议接入,视频播放出现断流是什么原因?
- O (log (min (m, n))
- 内网学习笔记(7)
- beescms网站渗透测试和修复意见「建议收藏」
- Notes on BGP part of CCNP
- Experience of epidemic prevention and control, home office and online teaching | community essay solicitation
- 3年测试经验,连简历上真正需要什么都没搞明白,张口就要20k?
- 华泰证券如何开户能做到万分之一?证券开户安全可靠吗
- Use of hashcat
猜你喜欢

入职一家新公司,如何快速熟悉代码?

MeterSphere開源持續測試平臺與阿裏雲雲效DevOps的集成
![Longest continuous sequence [diffusion method + space for time]](/img/db/7b0d1b0db7015e887340723505153a.png)
Longest continuous sequence [diffusion method + space for time]

软件测试人员的7个等级,据说只有1%的人能做到级别7
![[leetcode] 11. Container with the most water](/img/40/8bb6506a29f8da797432fee50d3aad.png)
[leetcode] 11. Container with the most water

1-6搭建Win7虚拟机环境

数据库系统概论必背知识

【直播回顾】战码先锋第七期:三方应用开发者如何为开源做贡献

Intégration de la plate - forme de test continu open source de metersphere avec Alibaba Cloud Effect devops

都2022年了,你还不了解什么是性能测试?
随机推荐
Test / development programmers, 30, do you feel confused? And where to go
业务与技术双向结合构建银行数据安全管理体系
Intranet learning notes (5)
指南针靠谱吗?开证券账户安全吗?
Kaggle 专利匹配比赛金牌方案赛后总结
Do you know your ABC
元宇宙的生态圈
Intranet learning notes (7)
菊花链(寒假每日一题 39)
MPLS notes Part 1
非凸联合创始人李佐凡:将量化作为自己的终身事业
2022-06-24:golang选择题,以下golang代码输出什么?A:1;B:3;C:4;D:编译失败。 package main import ( “f
Listen to the markdown file and hot update next JS page
2022年云计算应用关键威胁调查
File system - basic knowledge of disk and detailed introduction to FAT32 file system
Status quo analysis: how "one cloud and multi-core" can promote the rapid deployment of information innovation projects
Icml2022 | establishing a continuous time model of counterfactual results using neural control differential equations
What are the SQL aggregate functions
Rod and Schwartz cooperated with ZhongGuanCun pan Lianyuan Institute to carry out 6G technology research and early verification
DDD概念复杂难懂,实际落地如何设计代码实现模型?