Check if Array1 is the same as Array2

I have two variables Array1 and Array2 - both are ‘Arrays of Strings’.

I want to whether Array1 is identical to Array2 (the entire array in the same order if values).

If Array1=Array2 doesn’t work.

Does anyone have a suggestion?

1 Like

Buddy @andrewjames
this would help you to resolve your issue buddy (2.5 KB)

Kindly try this and let know buddy

Hi @andrewjames
Refer this link :

You’ll get the idea.

Thank you. I was hoping there would be a simpler solution than to loop through the array comparing values.

Hey @andrewjames

As per your words same Identical order of two string array then you can use below one line code to check :slight_smile:

String[ ] Str_Arr1={"aksh","aksh1yadav","akshay"};
String[ ] Str_Arr2={"aksh","aksh1yadav","akshay"};
String[ ] Str_Arr3={"aksh","aksh1yadav","akshay","New"};

Check like this:

bool Check = Str_Arr1.SequenceEqual(Str_Arr2).ToString  // True

bool Check1=Str_Arr1.SequenceEqual(Str_Arr3).ToString //False

bool Check2=Str_Arr2.SequenceEqual(Str_Arr3).ToString //False

StringArrayEqualCheck.xaml (6.2 KB)



Thank you Aksh - That sounds like it may work for me. I’ll give it a shot!

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