troubleshooting Question

Comparing 2 Lists of classes in C#

Avatar of the_7th_king
the_7th_kingFlag for India asked on
.NET ProgrammingC#ASP.NET
7 Comments1 Solution405 ViewsLast Modified:
Below are my 2 classes :

        public class CommtteeMemberData
    {
        public string officerid { get { return _officerid; } set { _officerid = officerid; } }
        private string _officerid;

        public string officername { get { return _officername; } set { _officername = officername; } }
        private string _officername;

        public string chairmanflag { get { return _chairmanflag; } set { _chairmanflag = chairmanflag; } }
        private string _chairmanflag;

        public string meetingattendancepercentage { get { return _meetingattendancepercentage; } set { _meetingattendancepercentage = meetingattendancepercentage; } }
        private string _meetingattendancepercentage;

        public string exceptionpayment { get { return _exceptionpayment; } set { _exceptionpayment = exceptionpayment; } }
        private string _exceptionpayment;
    }

    public class CommitteeData
    {
        public string committeeid { get { return _committeeid; } set { _committeeid = committeeid; } }
        private string _committeeid;

        public string committeename { get { return _committeename; } set { _committeename = committeename; } }
        private string _committeename;

        public string currencyid { get { return _currencyid; } set { _currencyid = currencyid; } }
        private string _currencyid;

        public string fees { get { return _fees; } set { _fees = fees; } }
        private string _fees;

        public string companyid { get { return _companyid; } set { _companyid = companyid; } }
        private string _companyid;

        public string formid { get { return _formid; } set { _formid = formid; } }
        private string _formid;

        public string fiscalyearid { get { return _fiscalyearid; } set { _fiscalyearid = fiscalyearid; } }
        private string _fiscalyearid;

        public List<CommtteeMemberData> memberlist = new List<CommtteeMemberData>();
    }

I create 2 lists of the type "CommitteeData" which I get from the client side using JSON like this :

        List<CommitteeData> orig = (List<CommitteeData>)Newtonsoft.Json.JsonConvert.DeserializeObject(ORIGJSONString, typeof(List<CommitteeData>));

        List<CommitteeData> toCompare = (List<CommitteeData>)Newtonsoft.Json.JsonConvert.DeserializeObject(JSONString, typeof(List<CommitteeData>));

My aim is to compare the 2 lists for additions, deleteion and editing.

The main keys of the above classes are committeeid & officerid.

NO LINQ syntax as the project is in .net 2.0

Any help is appreciated.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros