随笔分类 - Linq
摘要:using System; using System.Linq; using System.Xml.Linq; namespace Sample2 { class Program { static void Main(string[] args) { #region 写文件一(生成节点性质的) XD...
阅读全文
摘要:/*查找XML*/ var filePath = Server.MapPath("~/xml/sample.xml"); XDocument doc = XDocument.Load(filePath); var text1 = doc.Descendants("用户") //定位到节点 .Where(p => p.Element("性别").Value.Co...
阅读全文
摘要:ALTER VIEW [dbo].[view_TreeLevel] AS WITH cte AS ( SELECT a.ModuleID , a.Module_Name , a.Module_Description , a.Module_FatherID , a.Module_Url , a.Module_Order, 1 Le...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sample2 { class Program { static void Main(string[] args)...
阅读全文
摘要:/* 以下围绕Person类实现,Person类只有Name和Age两个属性 一.List排序 1.1 List提供了很多排序方法,sort(),Orderby(),OrderByDescending(). */ lstPerson = lstPerson.OrderByDescending(x=>x.Name).ToList(); //降序 lstPerson = lstPerson.Orde...
阅读全文
摘要:static void DeferredQuery() { var names = new List { "Nino", "Alberto", "Juan", "Mike", "Phil" }; var namesWithJ = from n in names ...
阅读全文
摘要:Restriction Operators Where - Simple 1 public void Linq1() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lowNums = from n in numbers where n 0 && p.UnitPrice > 3.00M...
阅读全文