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.
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} ));
}
Thank you in advance,
Natalia.