Linked Questions

193 votes
21 answers
120k views

I would like to compare two collections (in C#), but I'm not sure of the best way to implement this efficiently. I've read the other thread about Enumerable.SequenceEqual, but it's not exactly what I'...
mbillard's user avatar
  • 39k
7 votes
1 answer
3k views

I want to compare the values of two lists for a program I'm making. I want it to compare the 1st value of List 1 to the first value of List 2, and then the second value of List 1 to the second value ...
ShaunRussell's user avatar
1 vote
3 answers
7k views

I'm sure that my question is similar to many questions asked on StackOverflow. But I think that my problem is a little bit different from the questions asked here. What I need exactly is to compare ...
abdou31's user avatar
  • 75
0 votes
3 answers
1k views

I have two List<T> objects (where T is the same type for both objects), and I need to be able to determine whether they contain the same set of values, even if the values aren't in the same ...
Giffyguy's user avatar
  • 21.5k
-1 votes
3 answers
93 views

I have a Key object that has an attribute of type List<int> and it is called KeyProperties. Key object also has an int Id attribute. class Key { public int Id; public List<int> ...
disasterkid's user avatar
  • 7,328
1 vote
0 answers
78 views

I have two string list - List<string> ObjList1; List<string> ObjList2; How can I compare these two list efficiently, such a way that these should have exact match of parameter ...
Nitendra Jain's user avatar
0 votes
0 answers
71 views

I used the following 2 linq queries to check if two list are have exactly same contents(the type of list doesn't matter, assume List of string) bool haveSameContents = list1.All(x=>list2.Any(y=>...
Jajan's user avatar
  • 944
297 votes
5 answers
421k views

I have a class as follows: public class Tag { public Int32 Id { get; set; } public String Name { get; set; } } And I have two lists of tag: List<Tag> tags1; List<Tag> tags2; I ...
Miguel Moura's user avatar
3 votes
7 answers
1k views

Say I have a Tuple List like this: List<Tuple<string, string>> conflicts = new List<Tuple<string, string>>(); conflicts.Add(new Tuple<string, string>("Maths", "...
Dude365's user avatar
  • 75
1 vote
1 answer
6k views

I have four string as listed below. Though they have different order of characters and different spacing after comma – they are considered to have same business value. How do I check that all the ...
LCJ's user avatar
  • 22.8k
2 votes
1 answer
6k views

I'm trying to compare 2 Lists (wrapped in an object) containing custom objects. I don't care about the order, but if list 1 contains "1,2,3,4" then list 2 must and only contain those elements. E.g.: "...
RvdK's user avatar
  • 19.8k
1 vote
1 answer
874 views

I have two lists to compare: I want to compare List A and List B such that if any of the dates from ListB is present in List A then return true. For example, if 14-01-2020 (which is in List B) is ...
Rohan Rao's user avatar
  • 2,641
4 votes
2 answers
440 views

I have a collection of Component and these collections have a collection of Pax: public class Component { public IEnumerable<Pax> Paxes { get; set; } } public class Pax { public int ...
J-R Choiniere's user avatar
2 votes
3 answers
430 views

I am scratching my head over the following problem. I want to create a dictionary, which uses multiple keys. I came along the solutions suggesting tuples as the method of choice. I think this i a good ...
Johannes's user avatar
  • 171
-21 votes
1 answer
2k views

public class ClassA { public enum1 Type { get;set;} public List<ClassB> lst1 {get; set;} } public class ClassB { public string var1 { get;set;} public int var2 { get;set;} ...
chetanya gehlot's user avatar

15 30 50 per page