So currently there is a comparison project I'm working on, and I am receiving a list back with the two classes of information I need to compare. I'm working on this project in C# and it is being displayed on a MVC web page. I'm newer to C# and completely new to web dev.
I know I can write out one-by-one to compare the elements
EX:
List<ESHClass> eshlist; //This just to show that eshlist is of type ESHClass and i'm
purposefully comparing two elements from the same list
bool pNum = eshlist[0].PolicyNumber == eshlist[1].PolicyNumber;
But I was wondering if there were any more efficient ways to do it in C#? I need to compare one-by-one because I'll only be displaying the fields that are different. I've browsed a bit online, but didn't quite find what I was looking for. If you have any good tips or articles to send me in a better direction, I'd appreciate it!
CLARIFICATION:
I'm writing to clarify what I want to accomplish with my tool.
I will have a list of a class type (ex. ESHCLASS)
List<ESHClass> eshlist;
And ESHClass is composed of elements like:
public class ESHClass{
public string PolicyNumber;
public string PolicyMod;
public string MultiPolicy;
public string HasSwimmingPool;
};
So say eshlist has to policies(ESHClass) and there values equal:
eshlist[0].PolicyNumber= "7";
eshlist[0].PolicyMod= "00";
eshlist[0].MultiPolicy= "Yes";
eshlist[0].HasSwimmingPool= "No";
eshlist[1].PolicyNumber= "7";
eshlist[1].PolicyMod= "00";
eshlist[1].MultiPolicy= "No";
eshlist[0].HasSwimmingPool= "Yes";
So what i'm trying to do is compare each element in an abstract way and store only the ones that are different and display them on my site which is currently set up as an MVC ListView (Display isn't the part I had trouble with).
So in my example case, the website will show:
MultiPolicy Yes MultiPolicy No
HasSwimmingPool No HasSwimmingPool Yes