list collections
-
I have 2 list collections as below List1 115 100 150 List2 115 100 now i need to check both of above list and need to get answer for matched , for example : 115 100 both matched, i need to achieve this how can i do it ?
C# 3.5? list1.Intersect(list2)[^] (it's an extension method in System.Linq) If not, it's trivial to produce a naive implementation which will be fine for small lists:
IList<T> Intersection<T>(ICollection<T> one, ICollection<T> two){
IList<T> r = new List<T>();
foreach(T t in one)
if(two.Contains(t)) r.Add(t);
return r;
} -
I have 2 list collections as below List1 115 100 150 List2 115 100 now i need to check both of above list and need to get answer for matched , for example : 115 100 both matched, i need to achieve this how can i do it ?
You've been around long enough to know and understand the forum guidelines. DON'T REPOST. You asked this same question four hours ago in the C# forum, it has nothing to do with ASP.NET. If you didn't receive an answer, wait. Don't repost.
I know the language. I've read a book. - _Madmatt
-
You've been around long enough to know and understand the forum guidelines. DON'T REPOST. You asked this same question four hours ago in the C# forum, it has nothing to do with ASP.NET. If you didn't receive an answer, wait. Don't repost.
I know the language. I've read a book. - _Madmatt
-
I have 2 list collections as below List1 115 100 150 List2 115 100 now i need to check both of above list and need to get answer for matched , for example : 115 100 both matched, i need to achieve this how can i do it ?
Consider using HashSet instead.