Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
こんにちは、データベースに次の形式のメニュー構造があります。
Id | Id_Parent | Menu
このデータ構造を順番に並べて取得する必要がありidますid_parent。
id
id_parent
linq でこのクエリを実行するにはどうすればよいですか?
var orderedData = data.OrderBy(i => i.Id).ThenBy(i => i.Id_Parent);
@desの答えは正しいですが、これはクエリ構文を使用した同じクエリです(より読みやすいと思います)
var orderedData = from x in data orderby x.Id, x.Id_Parent select x;