の結果に応じてリストを並べたい
if(group.Substring(group.Length-1,1)%2==0)
降順
else
昇順
List<CellTemp> orderedCells =
(from shelf in foundCells
where Convert.ToInt32(shelf.Group.Substring(shelf.Group.Length - 1), 1) % 2 == 0
orderby shelf.Grup, shelf.Row descending
select new CellTemp()
{
cod= shelf.cod,
PN = shelf.PN,
Description = shelf.Description,
Group= shelf.Group,
Row= shelf.Row,
Shelf= shelf.Shelf
}).ToList();
shell.Group が奇数か偶数かに応じて、最初の shelf.Group OrderBy と OrderBy の Shelf.row を昇順または降順に保つにはどうすればよいですか?
shell.group のフォーマットは「Group_A0」です。
--------------------編集-------------------------------
混乱させて申し訳ありません。私はこのようなことをしたいです。
var orderCells = (from shelf in celuleGasite
where Convert.ToInt32(shelf.Gruup.Substring(shelf.Group.Length - 1, 1)) % 2 == 0
orderby shelf.Group, shelf.Row descending
where Convert.ToInt32(shelf.Group.Substring(shelf.Group.Length - 1, 1)) % 2 == 1
orderby shelf.Group, shelf.Row ascending
select shelf).ToList();
しかし、リストには0要素があります