Remove duplicate values in array

For example i have an array:
newArray = {“apple”, “apple”, “orange”}

How can I remove one of "apple"s from this array?
Thank you…

1 Like


Arrayvariable = newarray.Distinct().ToArray()

Hope this would help you resolve this

Cheers @Hulya_Cetinkaya

This does not obstruct array to make a process in a loop for the removed one. It workes as a empty value. I want to make it none value not empty value.

I tried in the same way
It’s working


“For each” loop is working for the empty value too, like you see in the picture. But it shouldn’t work process.

May I know What values are passed in newarray before removing duplicates


if you array has blank/empty/space values then a distinct will not sort it out
Line 2 from above
Line 3 is doing this

Kindly note: as this was not mentioned as a requirement, so it was not addditonal included within the solution suggestion