How to compare two lists(String)?

Hi everyone,
I have two lists,
L1={A,B,C,D}
L2={A,B,C,D,E,F}

We need to check whether L1 values are available in L2 without using ‘for each’ loop, and the result should be a Boolean variable.

Can anyone suggest a LINQ query?

Thank you.

@Guru_Koli21,

Use this LINQ

allContained = L1.All(Function(item) L2.Contains(item))

Here, allContained is a Boolean variable that will be True if all elements in L1 are present in L2 and False otherwise.

Input:

L1 = New List(Of String) From {"A", "B", "C", "D"}
L2 = New List(Of String) From {"A", "B", "C", "D", "E", "F"}

Logic:

Output:
image

Sample Workflow:
Workflow1.xaml (7.5 KB)

Thanks,
Ashok :slight_smile:

1 Like

Thank you so much… :hugs:

1 Like

@Guru_Koli21
LINQ learning resources:

3 Likes

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