Merge List <T> of the same type
I have 2 lists whose defs:
List<Type> filteredTypes = new List<Type>(); List<Type> interfaceTypes = new List<Type>();
When my lists are full, I would like to get one loop for both of them, and my idea is to combine them before the "loop", so I don't need to use LINQ (I don't like it) ..-_-) I checked online is a document, and I think I should do:
filteredTypes.Concat(interfaceTypes);
I debugged as deep as I could, and my lists match after the instructions ... What am I missing?
+4
6 answers
See here: .NET List <T> Concat vs AddRange
calling .Concat()
creates a new List<T>
, so you need something like:
var mergedList = filteredTypes.Concat(interfaceTypes);
+4