我目前正在使用
your = from p in (toSelect)
select new
{
last = p.Last,
current = p.CurrentPlayer,
seats = from s in (p.Seated)
select new
{
UID = s.UID,
buyin = s.BuyIn
}
}
p.Seated
是一个数组,如何在每次未设置 s.UID
时传递 null
?我知道“where
”,但我想知道哪些座位是空闲的(例如 null
)
希望这足够清楚。
最佳答案
你可以试试这个:
your = from p in (toSelect)
select new
{
last = p.Last,
current = p.CurrentPlayer,
seats = p.Seated.Select(s => s.UID != null
? new
{
UID = s.UID,
buyin = s.BuyIn
}
: null;
}
关于c# - 选择子句为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16984496/