il est difficile pour moi d'expliquer celui-ci, mais j'espère un code vous aidera:Linq Contient la valeur dans la liste
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)));
}
ce que je veux faire est, si g.GamingProperties.Software
contient l'un des Guids de softChannels, puis ajoutez-le. peut-être qu'une approche différente sera meilleure ... des suggestions?
p.s je sais que la ligne ne fonctionne pas, j'ai mis le code là seulement pour comprendre facilement ce dont j'ai besoin.
EDIT: je pense que je l'ai résolu, il:
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())));
}
si quelqu'un voit quelque chose de mal à cela, s'il vous plaît laissez-moi savoir.
exactement ce qui ne fonctionne pas et quelle erreur que vous obtenez? – BrokenGlass
De quel type est 'g.GamingProperties.Software'? – SLaks
string (contenant un guid) – Dementic