var listMsg = new List<string>(); response.ItemCats.OrderBy(item => item.Name).ToList() .ForEach(delegate(ItemCat item) { var msg = string.Format( "Cid:{0} Name:{1}", item.Cid, item.Name ); listMsg.Add(msg); }); var rtn = string.Join(",", listMsg);
var rtn2 = string.Join(",", response.ItemCats.OrderBy(item => item.Name).Select( item => string.Format( "Cid:{0} Name:{1}", item.Cid, item.Name ) ));
[.NET]快快樂樂學LINQ系列前哨戰-Func, Action, Predicate
第五屆鐵人賽文章索引-LINQ自學筆記
Delegates and lambdas 101
The Four Deadly Sins of LINQ Data Access: Part 1–Overly Chatty Queries
The Four Deadly Sins of LINQ Data Access: Part 2–Too Many Columns
How to perform Join between multiple tables in LINQ lambda
convert linq to lambda with multiple joins
LINQ 語法教學 *****
LINQ 101 Samples - Lambda Style
LINQ joins, both inner and outer, are not always what they seem and how you go about it may depend on whether you want grouping.
Join參考
LINQ: Add RowNumber Column
Implementing RANK OVER SQL Clause in C# LINQ
若出現NotSupportedException錯誤,可在GroupBy()之後做ToList(),再SelectMany()
Predicate Combinators in LINQ
Converting Linq Expressions to T-SQL
撰寫於 DB 端執行篩選、排序、與分頁的 LINQ 查詢
沒有留言:
張貼留言