Integer Array - get Distinct Values

Friends,

Could you please tell me the syntax of this below

Array={1,2,3,1,2,3}

the O/p should be unique values of the array.

Are you loooking for this?
grafik

Yea Peter, its Array on Int

Array={1,2,3,1,2,3} line is initializing an int array with different values

When it is done manually then go for
Array={1,2,3}
or use the Distinct on already populated array

you mean to say …

arr={1,2,3,1,2,3}
arr.Distinct(arr).ToArray()
…?

lets assume you have an array arrInt with the values 1,2,3,1,2,3
then arrInt.Distinct().toarray will return the distinct, non duplicated values

more clear?

err

eerr

or do I need to iterate ?

we have to do following for displaying it in th message box (getting string representation)
String.Join(“,”,arrInt.Distinct().toarray)

But it is more preferable to debug and using locals / watch / immediate panel
grafik

1 Like

:raised_hands: :raised_hands: :raised_hands:

thank you Peter

Thanks for giving fast response :slight_smile:

perfect when it is solved please mark the solving post solution. So others can benefit from it. Thanks

done :+1:

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