Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

Find on a List<> of objects

public class StateData
    {
        public StateData(string tempabbrev, string tempfullstatename)
        {
            abbrev = tempabbrev;
            fullstatename = tempfullstatename;
        }

        public string abbrev = "";
        public string fullstatename = "";
    }


I have a collection of states in another list .... if any of those are found in my List<StateData> I want to do something.


Please provide sample C# code.
ASKER CERTIFIED SOLUTION
Avatar of Omego2K
Omego2K
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tom Knowlton

ASKER

My eventual solution:


 foreach (string s in tempstates)
            {
                foreach (FinishPointLeadCollator.StateData sc in this._fmlc._statedata)
                {
                    if (s == sc.abbrev)
                    {
                        sc.itemischecked = true;
                    }
                }
            }

Open in new window