List<T>.ForEach Method (Action<T>) how to pass action to it

hi,
I am trying to compare list with string using Contains String element… In input: list.foreach(delegate(MailMessage)) and In search: string
But In input it is showing error as ‘)’ Expected…

1 Like

I’m not sure if I understand the question…

Could you elaborate on what is the input and expected output? From the description I don’t see a reason to use a .ForEach here.
Do note that .ForEach(Action<T>) is for invoking a (usually anonymous) void method on each of the elements and is a syntax equivalent of:
foreach (T item in List<T>) myVoidMethod(item);

If the Action you want to pass is not very simple, I’d suggest to either make an activity for it or use a normal ForEach loop and do it in it’s body.

Regards.

Hey, I am also beset with this issue… Could you please share the solution if you have found it?