Add condition in Linq?

Now I use linq as below.

String.Join(Environment.NewLine, DTFinal.AsEnumerable().Where(Function(r) r(“Result”).ToString.Trim<>“Not D3”).Select(Function(m) m(“BA”).ToString.Trim).ToArray().Distinct)

But I want to add condition for column in PRODUCT_NAME must contains FMC.
image

Please guide me about it.

Hi,

How about the following?

String.Join(Environment.NewLine, DTFinal.AsEnumerable().Where(Function(r) r("Result").ToString.Trim<>"Not D3" AndAlso r("PRODUCT_NAME").ToString.Contains("FMC")).Select(Function(m) m("BA").ToString.Trim).ToArray().Distinct)

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.