FindAll in List of Objects Containing List

Posted on 2011-10-19
Last Modified: 2012-05-12
I have a list of objects containing a list of other objects, and I'm wondering if there's a way to use List.FindAll (or anything else really... other than writing looping constructs) to get a list returned of LogInfo objects whose aliases list member contains a specific name value.

List<LogInfo> Translation = new List<LogInfo>();

public class LogInfo
            public string existingName;
            public string newName;
            public int existingLSN;
            public string desc;
            public string units;
            public int rule;
            public List<AliasLog> aliases = new List<AliasLog>();

        public class AliasLog
            public string name;
            public int lsn;

Open in new window

Question by:diablo089
    LVL 22

    Accepted Solution

    tempList = list.FindAll(x=>x.aliases.Exists(y=> == yourStringToCompare));

    //i did not test this on my end.

    Author Comment

    I think this works. Short and sweet. Thank you very much.
    LVL 22

    Expert Comment

    you are welcome

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now