摘要: ToArrayThis sample uses ToArray to immediately evaluate a sequence into an array.publicvoidLinq54(){double[]doubles={1.7,2.3,1.9,4.1,2.9};varsortedDoubles=fromdindoublesorderbyddescendingselectd;vardoublesArray=sortedDoubles.ToArray();Console.WriteLine("Everyotherdoublefromhighesttolowest:" 阅读全文
posted @ 2011-03-13 20:13 i'm zjz 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Distinct - 1This sample uses Distinct to remove duplicate elements in a sequence of factors of 300.publicvoidLinq46(){int[]factorsOf300={2,2,3,5,5};varuniqueFactors=factorsOf300.Distinct();Console.WriteLine("Primefactorsof300:");foreach(varfinuniqueFactors){Console.WriteLine(f);}}ResultPri 阅读全文
posted @ 2011-03-13 20:12 i'm zjz 阅读(387) 评论(0) 推荐(0) 编辑
摘要: GroupBy - Simple 1This sample uses group by to partition a list of numbers by their remainder when divided by 5. publicvoidLinq40() { int[]numbers={5,4,1,3,9,8,6,7,2,0}; varnumberGroups= fromninnumbers groupnbyn%5intog selectnew{Remainder=g.Key,Numbers=g}; foreach(varginnumberGroups) { Console.Write 阅读全文
posted @ 2011-03-13 20:08 i'm zjz 阅读(331) 评论(0) 推荐(0) 编辑
摘要: OrderBy - Simple 1This sample uses orderby to sort a list of words alphabetically.publicvoidLinq28(){string[]words={"cherry","apple","blueberry"};varsortedWords=fromwinwordsorderbywselectw;Console.WriteLine("Thesortedlistofwords:");foreach(varwinsortedWords){C 阅读全文
posted @ 2011-03-13 19:45 i'm zjz 阅读(300) 评论(0) 推荐(0) 编辑
摘要: Take - SimpleThis sample uses Take to get only the first 3 elements of the array.publicvoidLinq20(){int[]numbers={5,4,1,3,9,8,6,7,2,0};varfirst3Numbers=numbers.Take(3);Console.WriteLine("First3numbers:");foreach(varninfirst3Numbers){Console.WriteLine(n);}}ResultFirst 3 numbers:541Take - Ne 阅读全文
posted @ 2011-03-13 19:44 i'm zjz 阅读(318) 评论(0) 推荐(0) 编辑
摘要: Select - Simple 1This sample uses select to produce a sequence of ints one higher than those in an existing array of ints.publicvoidLinq6(){int[]numbers={5,4,1,3,9,8,6,7,2,0};varnumsPlusOne=fromninnumbersselectn+1;Console.WriteLine("Numbers+1:");foreach(variinnumsPlusOne){Console.WriteLine 阅读全文
posted @ 2011-03-13 19:43 i'm zjz 阅读(365) 评论(0) 推荐(0) 编辑
摘要: Where - Simple 1This sample uses where to find all elements of an array less than 5.publicvoidLinq1(){int[]numbers={5,4,1,3,9,8,6,7,2,0};varlowNums=fromninnumberswheren<5selectn;Console.WriteLine("Numbers<5:");foreach(varxinlowNums){Console.WriteLine(x);}}ResultNumbers < 5:41320Wh 阅读全文
posted @ 2011-03-13 19:41 i'm zjz 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--functionmyCallback(dialogResult,returnValue){alert(returnValue.toString())}functionshowDialog(){varo... 阅读全文
posted @ 2010-11-22 16:35 i'm zjz 阅读(390) 评论(0) 推荐(0) 编辑
摘要: Sharepoint 内置了几种列表类型:  [代码]新建列表Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--///<summary>///新建列表///</summary>///<paramname="sender"&g... 阅读全文
posted @ 2010-11-06 12:14 i'm zjz 阅读(1075) 评论(1) 推荐(0) 编辑
摘要: 代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1publicclassMyTemplate:ITemplate2{3System.Web.UI.WebControls.ListItemTypetemplateType;4staticinttitl... 阅读全文
posted @ 2010-10-30 07:39 i'm zjz 阅读(859) 评论(0) 推荐(0) 编辑