网站首页 站内搜索

搜索结果

查询Tags标签: LINQ,共有 73条记录
  • C#快速生成有序数组和将数组乱序

    生成有序的数组: 方法一:List<int> numList1 = new List<int>();for (int i = 0; i < 1000; i++) {numList1.Add(i); }View Code 方法二: 使用Linq,推荐日常使用List<int> numList2 = Enumerable.Range(0, 1000).ToList(); 补充: 如果要将上面…

    2021/8/19 12:06:05 人评论 次浏览
  • C# Linq

    // 注意文件开头: // using System.Linq;int[] scores = new int[] { 97, 92, 81, 60 };System.Collections.Generic.IEnumerable<int> scoreQuery =from score in scoreswhere score > 80select score;string logStr = ""; foreach (int i in scoreQ…

    2021/8/12 20:06:15 人评论 次浏览
  • C# Linq

    // 注意文件开头: // using System.Linq;int[] scores = new int[] { 97, 92, 81, 60 };System.Collections.Generic.IEnumerable<int> scoreQuery =from score in scoreswhere score > 80select score;string logStr = ""; foreach (int i in scoreQ…

    2021/8/12 20:06:15 人评论 次浏览
  • C#基础_学习笔记--LINQ常用扩展方法

    LINQ:常用扩展方法1 Linq中提供了大量类似Where的扩展方法,简化了数据处理。大部分都在System.Linq命名空间中。 数组、List、Dictionary、Set等都实现了IEnumerable,所以都可以使用IEnumerable扩展方法,可以用linq;Where方法 每一项数据都会经过predicate的测试,如…

    2021/8/7 20:07:58 人评论 次浏览
  • C#基础_学习笔记--LINQ常用扩展方法

    LINQ:常用扩展方法1 Linq中提供了大量类似Where的扩展方法,简化了数据处理。大部分都在System.Linq命名空间中。 数组、List、Dictionary、Set等都实现了IEnumerable,所以都可以使用IEnumerable扩展方法,可以用linq;Where方法 每一项数据都会经过predicate的测试,如…

    2021/8/7 20:07:58 人评论 次浏览
  • 68.(linq)union查询数据集

    var datas = (from s in db.studentsselect new {Name = s. Name }).Union( (from t in db.teachersselect new {Name = t.Name} ));

    2021/8/3 23:06:14 人评论 次浏览
  • 68.(linq)union查询数据集

    var datas = (from s in db.studentsselect new {Name = s. Name }).Union( (from t in db.teachersselect new {Name = t.Name} ));

    2021/8/3 23:06:14 人评论 次浏览
  • 33.(linq)linq如何使用sql语句查询当前table的主键字段的最大数值

    long? maxCount = db.Database.SqlQuery<nullabled<long>>("select max(id) from [Student]").FirstOrDefault(); if(maxCount !=null) maxid = maxCount; maxid ++;

    2021/7/23 2:05:59 人评论 次浏览
  • 33.(linq)linq如何使用sql语句查询当前table的主键字段的最大数值

    long? maxCount = db.Database.SqlQuery<nullabled<long>>("select max(id) from [Student]").FirstOrDefault(); if(maxCount !=null) maxid = maxCount; maxid ++;

    2021/7/23 2:05:59 人评论 次浏览
  • 26.(linq)linq过滤skip 及提取tank查询操作

    1.//get the take information var name1 =db.students.Skip(n-1).Take(1).FirstOrDefault(); var name2 =db.students.Skip(n).Take(1).FirstOrDefault(); 2.then use the name1 and name2 to search the information

    2021/7/22 6:10:27 人评论 次浏览
  • 26.(linq)linq过滤skip 及提取tank查询操作

    1.//get the take information var name1 =db.students.Skip(n-1).Take(1).FirstOrDefault(); var name2 =db.students.Skip(n).Take(1).FirstOrDefault(); 2.then use the name1 and name2 to search the information

    2021/7/22 6:10:27 人评论 次浏览
  • linq查询,根据主键查询程序案例1(一看就懂)

    1.根据主键查询 Find() 此方式,性能高,执行查询先从内存中找,然后去数据库找。1 //1.根据主键查询 2 //Find() 3 Course couse1 = _context.Courses.Find(1); 实际上确实,就是一行代码的事情。 查询代码就一行, 折腾2天整不了?... 关键代码就一行, 关键是在于明白…

    2021/7/9 14:09:20 人评论 次浏览
  • linq根据一个动物类,获取类型程序案例,以及工作中代码注释(一看就懂)

    1 using System;2 using System.Linq;// 3 using System.Collections.Generic;4 5 6 namespace ConsoleLinq7 {8 class Program9 { 10 static void Main(string[] args) 11 { 12 /* 13 14 这是一个根据…

    2021/7/8 22:06:12 人评论 次浏览
  • EF Linq To Sql程序案例练习1(一看就懂)

    https://docs.microsoft.com/zh-cn/ef/core/querying/ 官网 Entity Framework Core 使用语言集成查询 (LINQ) 来查询数据库中的数据。 通过 LINQ 可使用 C#(或你选择的其他 .NET 语言)编写强类型查询。 它使用你派生得到的上下文和实体类来引用数据库对象。 EF Core 将 …

    2021/7/8 19:35:50 人评论 次浏览
  • C# 中的 linq 之SELECT 与 WHERE踩坑(框架思考)(一)反面教材

    1 var stockMaterials = this._PEService.GetStockMaterial(materialSnList).AsEnumerable().Select(r => new 2 { 3 MaterialCode = r["MaterialCode"]?.ToString(), 4 MaterialName = r["MaterialName&…

    2021/7/1 1:50:37 人评论 次浏览
扫一扫关注最新编程教程