上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: Xcode提供了若干模板骨架,可以在应用程序中实现MVC架构。下面是最常用到的一些模板。基于视图的应用程序(view-based application)应用程序如果仅使用一个视图,应该使用这个模板。一个简单的视图控制器会管理应用程序的主视图,而界面布置则使用一个Interface Builder模板来定义(不过我们会教你如何去掉这东西,并按照自己的希望来构建界面)。那些未使用任何导航功能的简单应用程序应该使用这个模板。如果你的应用程序需要在多个视图之间切换,请考虑使用基于导航的模板。基于导航的应用程序(navigation-based application)基于导航的模板的理想用途,就是那 阅读全文
posted @ 2011-03-23 15:34 i'm zjz 阅读(1382) 评论(0) 推荐(0) 编辑
摘要: 项目中的一个教训List<News>listNews=userQueryScopeList.OrderByDescending(it=>it.PublishTime).OrderByDescending(it=>it.CreatedOn).OrderByDescending(it=>it.ModifiedOn).ToList();这儿的排序顺序是ModifiedOn,CreatedOn,PublishTime,即从后往前 阅读全文
posted @ 2011-03-17 16:23 i'm zjz 阅读(229) 评论(0) 推荐(0) 编辑
摘要: Cross JoinThis sample shows how to efficiently join elements of two sequences based on equality between key expressions over the two.publicvoidLinq102(){string[]categories=newstring[]{"Beverages","Condiments","Vegetables","DairyProducts","Seafood"};L 阅读全文
posted @ 2011-03-13 21:07 i'm zjz 阅读(335) 评论(0) 推荐(0) 编辑
摘要: Deferred ExecutionThe following sample shows how query execution is deferred until the query is enumerated at a foreach statement.publicvoidLinq99(){//Sequenceoperatorsformfirst-classqueriesthat//arenotexecuteduntilyouenumerateoverthem.int[]numbers=newint[]{5,4,1,3,9,8,6,7,2,0};inti=0;varq=fromninnu 阅读全文
posted @ 2011-03-13 21:05 i'm zjz 阅读(256) 评论(0) 推荐(0) 编辑
摘要: CombineThis sample calculates the dot product of two integer vectors. It uses a user-created sequence operator, Combine, to calculate the dot product, passing it a lambda function to multiply two arrays, element by element, and sum the result.public static class CustomSequenceOperators{public static 阅读全文
posted @ 2011-03-13 21:04 i'm zjz 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Concat - 1This sample uses Concat to create one sequence that contains each array's values, one after the other.publicvoidLinq94(){int[]numbersA={0,2,4,5,6,8,9};int[]numbersB={1,3,5,7,8};varallNumbers=numbersA.Concat(numbersB);Console.WriteLine("Allnumbersfrombotharrays:");foreach(varn 阅读全文
posted @ 2011-03-13 20:20 i'm zjz 阅读(348) 评论(0) 推荐(0) 编辑
摘要: Count - SimpleThis sample uses Count to get the number of unique factors of 300.publicvoidLinq73(){int[]factorsOf300={2,2,3,5,5};intuniqueFactors=factorsOf300.Distinct().Count();Console.WriteLine("Thereare{0}uniquefactorsof300.",uniqueFactors);}ResultThere are 3 unique factors of 300.Count 阅读全文
posted @ 2011-03-13 20:19 i'm zjz 阅读(297) 评论(0) 推荐(0) 编辑
摘要: Any - SimpleThis sample uses Any to determine if any of the words in the array contain the substring 'ei'.publicvoidLinq67(){string[]words={"believe","relief","receipt","field"};booliAfterE=words.Any(w=>w.Contains("ei"));Console.WriteLine( 阅读全文
posted @ 2011-03-13 20:18 i'm zjz 阅读(274) 评论(0) 推荐(0) 编辑
摘要: RangeThis sample uses Range to generate a sequence of numbers from 100 to 149 that is used to find which numbers in that range are odd and even.publicvoidLinq65(){varnumbers=fromninEnumerable.Range(100,50)selectnew{Number=n,OddEven=n%2==1?"odd":"even"};foreach(varninnumbers){Cons 阅读全文
posted @ 2011-03-13 20:17 i'm zjz 阅读(181) 评论(0) 推荐(0) 编辑
摘要: First - SimpleThis sample uses First to return the first matching element as a Product, instead of as a sequence containing a Product.publicvoidLinq58(){List<Product>products=GetProductList();Productproduct12=(frompinproductswherep.ProductID==12selectp).First();ObjectDumper.Write(product12);}R 阅读全文
posted @ 2011-03-13 20:15 i'm zjz 阅读(184) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页