I'm attempting to compare list of ints to a list of objects. to see if one of the IDs match the a key in each object. If it does then return true, else false.
for example:
List<int> ints = new List<int> () {
1, 2, 3, 4, 5};
List<someObjectType> objects = new List<someObjectType> () {
{1, "one"}, {6, "six"}, {45, "forty-five"} };
(x => x.objects.any(a => ints.contains(x.id)));
However I don't know how to compare a list of ints to only one property on an object, I only know how to compare whole arrays to each other.
dynamicor reflection for runtime binding, orvarfor compile-time binding. In aList<anon>,varis not usable. Your use of an anonymous type here seems contrived.Dictionary<int,string>List<object>should beDictionary<int,string>orList<KeyValuePair<int,string>>.