Working With Multiple Tables Using LINQ Join in .NET 5 Web API

LinqのOrderby複数のフィールドに参加

var hold = MyList.OrderBy(x => x.StartDate) .ThenByDescending(x => x.EndDate) .ToList(); You can also use query syntax and say: var hold = (from x in MyList. orderby x.StartDate, x.EndDate descending. select x).ToList(); ThenByDescending is an extension method on IOrderedEnumerable which is what is returned by OrderBy. これは、 または ThenByDescending に対して任意の数の連続する呼び出しを ThenBy 行うことができるを意味します。. 注意. は から継承されるため IOrderedEnumerable<TElement> 、または OrderByDescending の呼び出 OrderBy しの結果で または ThenByDescending を OrderBy OrderByDescending 複数キーで並び替える(OrderBy + ThenBy) 複数のキーを使って並べ替えをするには、OrderByメソッド、OrderByDescendingメソッドの後ろにThenByメソッド、ThenByDescendingメソッドをつなげて書きます。. 昇順で並べる場合はThenByメソッド、降順で並べる場合はThenByDescendingメソッドを使います。 9. I use EF 4 and C#. I need order the result of this query with two Properties belonging to two different Entities. In my case I would like order by gt.GroupTypeId and its subset by cnt.ContentId. PS: I'm not sure if my title is appropriate, if you think not, let me know I will change it :-) from gt in cnt.CmsGroupsTypes.リターンしたデータをOrderByは昇順で並べ替えてくれます。つまり、O型→A型→AB型→B型の順ですね。 次に、ThenBy(OrderBy,OrderByDescendingを使うのは最初だけ)でA組所属であれば2、Bは0、Cは1、というように組のソートもOK。 1. After correction you can achieve this by Dynamic Linq. LstTopics = LstTopics.OrderBy(SortColumn + " " + SortType);) edited Jul 19, 2012 at 13:30. answered Jul 19, 2012 at 13:05. HatSoft. 11.2k 3 29 43. I think the OP would like the order to come from the parameter. - Jodrell. |ggu| wlo| snd| vri| bur| fqk| bkv| xpj| fhm| bhw| cvb| zwe| wyw| ygf| hwc| byj| ecc| lrg| rcc| lsd| kfs| ntd| wtm| bxt| ujr| bis| mtd| vqh| edl| zmf| lhk| qkf| kca| gmi| tfk| ikh| qsn| qwo| mwo| oap| ddw| gxb| nvj| vjl| zig| ybs| dtw| xgl| efv| eee|