Hello gurus!
Could you please advice how to call delegate with 2 params within Enumerable::Select?
I have understanding how to call function with 1 param (getId sample below), but didn't managed to pass extra params (isIdInCollection func).
It's not possible to me to share someIds List as global var for IsIdInCollection , only way is to pass it as argument.
Thank you in advance,Code:Guid GetId (MyStruct^ s) { return s->Id; } bool IsIdInCollection (Guid id, List<Guid>^ collection) { return Enumerable::Contains(collection, id); } void Test (List<MyStruct^>^ structCollection, List<Guid>^ someIds) { auto getId = gcnew Func<MyStruct^, Guid>(GetId); List<Guid>^ idCollection = Enumerable::ToList(Enumerable::Select(structCollection, getId)); auto isIdInCollection = gcnew Func<Guid, List<Guid>^, bool>(IsIdInCollection); List<Guid>^ selectedIdCollection = Enumerable::ToList(Enumerable::Select(idCollection, isIdInCollection {someIds} )); }
Natalia.




Reply With Quote