using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LINQ_join
{
public class Student
{
public int Id;
public int Age;
public string Name;
//显示的提供一个构造函数以便于初始化
public Student(int id, int age, string name)
{
this.Id = id;
this.Age = age;
this.Name = name;
}
}
public class Course
{
public int Id;
public string CourseName;
public Course(int id, string courseName)
{
this.Id = id;
this.CourseName = courseName;
}
class Program
{
static void Main(string[] args)
{
//使用强类型来初始化对象
List<Student> stu = new List<Student>();
stu.Add(new Student(1, 21, "小雨"));
stu.Add(new Student(2, 24, "小魏"));
C# LINQ(三)连接
最新推荐文章于 2025-08-04 14:12:33 发布
本文探讨了C# LINQ中`Select`的常见用法,包括基本的项目选择、匿名类型的创建以及如何利用`Select`进行条件筛选、嵌套和本地方法调用。通过实例解析,帮助开发者掌握`Select`在实际开发中的应用。

最低0.47元/天 解锁文章
3712

被折叠的 条评论
为什么被折叠?



