I was just wondering not just concerning this piece of code but in some other code as well how can i avoid --> if (j!=array.Length-1) and put something else maybe
something in the for loop? LINE6

for (int i = 0; i < array.Length; i++)
            {

               for (j=counter; j < array.Length; j++)
                {
                    if (j!=array.Length-1)
                    {
                        if (array[i] == array[j+1] ) 
                         {
                             array[i] = 0;

                         }
                     }

                }
                if (array[i] != 0)
                {
                    items.Add(array[i]); // storing none duplicates random number.
                }
                counter++;
               }

int max = array.GetUpperBound();

commented: tnx +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.