How can i check the index length in long[] array?
<p>For example i have a long[] x
And im doing:</p>

<pre><code>for (int i=0; i&lt;x.length;x--)
{
}
</code></pre>

<p>I know that in x for example i have 30 indexs cells.
How can i loop over the cells(indexs) in the x array and find on each cell the length of it and also to get/show the numbers in each cell.</p>

<p>If in x[0] there is 232 
And in x[1] there is 21
And so on...</p>

<p>I want to display 232,21,....etc
And then i want to check that if x[i].length is above 0 do...
But there is no x[i].length</p>

<p>So how do i do it ?</p>

<hr>

<p>I did:</p>

<pre><code>public long GetHistogramMaximum(long[] histogram)
        {
            long result = 0;
            long count = 0;

            for (int i = 0; i &lt; histogram.Length; i++)
            {
                if (histogram[i] &gt; 0)
                {
                    MessageBox.Show(histogram[i].ToString());
                    break;
                }

            }

            return result;




        }
</code></pre>

<p>And its working but each time its showing me the number twice why the messagebox is working twice each time ?
If in the first array the number is 33454 then i see the messagebox once and then once again. Whats wrong here ? I want it to show me the number only once each time.</p>

<p>Its like repeating each number and show it once and then once again and only then moving to the next one.</p>

<p>EDIT **</p>

<p>Maybe the problem its showing the number twice each time have something to do with the scroll event im using ?</p>

<pre><code>void trackBar1_Scroll(object sender, EventArgs e)
        {
            myTrackPanelss1.trackBar1.Minimum = 0;
            myTrackPanelss1.trackBar1.Maximum = counter - 1;//list_of_histograms.Count-1;
            long[] tt = list_of_histograms[myTrackPanelss1.trackBar1.Value];
            histogramControl1.DrawHistogram(tt);
            long res = GetTopLumAmount(tt, 1000);
            long max = GetHistogramMaximum(tt);
            if (res &gt; -1)
            label24.Text = (res / 1000.0).ToString();
            setpicture(myTrackPanelss1.trackBar1.Value);
            this.pictureBox1.Refresh();
        }
</code></pre>

<p>For some reason its getting to the scroll and do everything here again. Twice in a row.
What can be the problem ?</p>
