4
其我很难解释这一个,但我希望一些代码将有助于:的LINQ包含值列表
var softChannels = channels.ByPath("/software/").Children.Where(c => c.StateProperties.IsActive);
var tmpGames = new List<MyCms.Content.Games.Game>();
// Get games only from active game channels
foreach (var channel in channels.ByPath("/gameslivecasinodirectcom/game-channels/").Children.Where(c => c.StateProperties.IsActive))
{
// QUESTION IS ABOUT THIS LINE
tmpGames.AddRange(oGames.AllActive.Where(g => g.StateProperties.Channels.Contains(channel.Guid) && g.GamingProperties.Software.Contains(softChannels)));
}
我想要做的是,如果g.GamingProperties.Software
包含softChannels的的GUID的一个,然后添加它。也许不同意见会更好......有什么建议吗?
p.s我知道该行不工作,我已经把代码放在那里,只是为了方便理解我需要什么。
编辑: 我想我已经解决了它:
var softChannels = channels.ByPath("/software/").Children.Where(c => c.StateProperties.IsActive).Select(c => c.Guid);
var tmpGames = new List<MyCms.Content.Games.Game>();
// Get games only from active game channels
foreach (var channel in channels.ByPath("/gameslivecasinodirectcom/game-channels/").Children.Where(c => c.StateProperties.IsActive))
{
tmpGames.AddRange(oGames.AllActive.Where(g => g.StateProperties.Channels.Contains(channel.Guid) && softChannels.Contains(g.GamingProperties.Software.Trim())));
}
如果有人认为有点不妥,请让我知道。
究竟是不是工作,你得到了什么错误? – BrokenGlass
'g.GamingProperties.Software'是什么类型? – SLaks
字符串(包含一个guid) – Dementic