08 2022 档案
摘要:1.数据准备: 假设有几个重复数据,如下,(正常使用Distinct()方法,我们想要排除掉重复的对象) using System.Collections.Generic; namespace LINQTutorial { public class Student { public int ID {
阅读全文
摘要:这边以Sum为例,Max,Min,Average用法类似 一、 Array static void SumArray() { Console.WriteLine("SumArray:"); int[] intNumbers = new int[] { 10, 30, 50, 40, 60, 20,
阅读全文
摘要:一、数据准备 public class Student { public int ID { get; set; } public string Name { get; set; } public string Gender { get; set; } public string Branch { g
阅读全文
摘要:一、数据准备 public class Student { public int ID { get; set; } public string Name { get; set; } public string Gender { get; set; } public string Branch { g
阅读全文
摘要:一、数据准备 public class Employee { public int ID { get; set; } public string Name { get; set; } public int AddressId { get; set; } public int DepartmentId
阅读全文
摘要:一、 数据准备 public class Employee { public int ID { get; set; } public string Name { get; set; } public int AddressId { get; set; } public static List<Emp
阅读全文
摘要:Create Table Employee (ID int identity(1,1) primary key, FullName nvarchar(20) not null, DeptID int , AddressID int )
阅读全文
摘要:1. 数据准备 Employee类如下:(构造数据时,特意把奇数ID的Employee设置成没有Department) public class Employee { public int ID { get; set; } public string Name { get; set; } publi
阅读全文
摘要:1. 数据准备 using System.Collections.Generic; namespace LINQTutorial { public class Employee { public int ID { get; set; } public string Name { get; set;
阅读全文
摘要:官方解释 上面解释:1)TryGetValue是根据key返回相应的数据到value,如果没有key则返回默认值到value; 2)这个方法的返回是bool值,如果dictionary里有存在相应的key为true,没有存在,则为false 例子1 using System; using Syste
阅读全文
摘要:问题:“HttpContent”未包含“ReadAsAsync”的定义,并且找不到可接受第一个“HttpContent”类型参数的可访问扩展方法“ReadAsAsync”(是否缺少 using 指令或程序集引用?) 解决方案:添加引用System.Net.Http.Formatting
阅读全文
摘要:1.建立一个测试数据库表如下: CREATE Table dbo.DumpData (ID INT, Name VARCHAR(50) ) INSERT INTO dbo.DumpData (ID, Name) VALUES(1, 'abc'), (2, 'AbC'), (3, 'aBc'), (4
阅读全文
摘要:1.CI和CS分别代表什么? CI=Case Insensitive(不区分大小写) CS=Case Sensitive(区分大小写) 查看database server collation(collation:排列规则) 2.判断一个服务器是否区分大小写 select SERVERPROPERTY
阅读全文
摘要:1. 例子: SELECT * FROM [NORTHWND].[dbo].[Customers] where CompanyName = 'alfreds futterkiste' 2. 运行结果如下: 3.如何让查询区分大小写?(利用collate) 把上面的语句改为如下: SELECT * F
阅读全文
摘要:1.IEnumberable IEnumerable<Customers> customers =Customers.Where(q => q.CompanyName.StartsWith("A")); customers = customers.Take<Customers>(10); custo
阅读全文
摘要:1.代码如下: 2.测试结果如下: 3.如果注释掉throw 4.可以返回结果如下: 5.参考网址: https://blog.csdn.net/LQ753799168/article/details/114504824
阅读全文
摘要:1.一对一:one-to-one relation 2.一对多:one-to-many 3.多对多many-to-many relation 参考网址: https://www.tutorialsteacher.com/sqlserver/tables-relations
阅读全文
摘要:1.语法如下: 以下截图来自:https://www.w3schools.com/jsref/jsref_reduce.asp 解释: 1)array是原始数组 2)total:必填项,表示初始值或上一次调用回调时的返回值 3)currentValue:必填项,当前正在处理的数组元素 4)curre
阅读全文