Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6223525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:30:18+00:00 2026-05-24T08:30:18+00:00

i have two lists which contains guids: var activeSoftware = channels.ByPath(/software/).Children.Where(c => c.StateProperties.IsActive).Select(c =>

  • 0

i have two lists which contains guids:

    var activeSoftware = channels.ByPath("/software/").Children.Where(c => c.StateProperties.IsActive).Select(c => c.Guid);
    var activeChannels = channels.ByPath("/game-channels/").Children.Where(c => c.StateProperties.IsActive).Select(c => c.Guid);

and another list, of games:

List<MyCms.Content.Games.Game> games = new List<MyCms.Content.Games.Game>();

the game object has two properties that can use:

game.gamingproperties.software – which contains the guid of the software
game.stateproperties.channels – a list of comma seperated guids

yes, i know its not good to save comma seperated values in a field,
but i cannot change it at this point of time ( its allready working on 40+ sites )

what i want to do, is select all games where the software is active ( by comparing softwarelist to the game.gamingproperties.software ) and that the channels they appear in is active ( by checking if game.stateproperties.channels contains any of activechannels guids )

originally, i have done this like so:

    foreach (var channel in activeSoftware)
    {
        foreach (var match in oGames.AllActive.Where(g => !string.IsNullOrEmpty(g.GamingProperties.UrlDirectGame) && g.GamingProperties.Software.Contains(channel) && g.StateProperties.Channels.Split(',').Intersect(activeChannels).Any()))
        {
            games.Add(match);
        }
    } 

but i am sure i can get rid of those nasty foreach and just use linq.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:30:18+00:00Added an answer on May 24, 2026 at 8:30 am

    Your object model does look a little odd, so I think it could be refactored somewhat, but here’s my answer:

    var query =
        from channel in activeSoftware
        from match in oGames.AllActive
        where !string.IsNullOrEmpty(match.GamingProperties.UrlDirectGame)
        where match.GamingProperties.Software.Contains(channel)
        where match.StateProperties.Channels.Split(',').Intersect(activeChannels).Any()
        select match;
    
    var games = query.ToList();
    

    You could also do this, if I understand your model correctly:

    var query =
        from match in oGames.AllActive
        where !string.IsNullOrEmpty(match.GamingProperties.UrlDirectGame)
        where match.GamingProperties.Software.Intersect(activeSoftware).Any()
        where match.StateProperties.Channels.Split(',').Intersect(activeChannels).Any()
        select match;
    
    var games = query.ToList();
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here’s my problem, I have two different lists, list a which contains the name
I have two lists which are guaranteed to be the same length. I want
I have two unsorted lists and I need to produce another list which is
I have two lists and I want to select items that are not in
Let's say I have a list somewhere called majorPowers which contain these two lists:
In my code, I have two lists, of different lenghts, which I'll call main
Form contains two dropdown lists created using code below. Both dropdown list elements have
I have an XML file which contains lists of stores, a simplified version is
I have two 2D numpy arrays - real r , which contains points in
I have the following scenario: Two lists of different Types which happen to contain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.