Reputation: 11319
Im doing this:
long[] HistogramValues = Form1.GetHistogram(bitmap);
Form1.Histograms.AddRange(HistogramValues);
But then Histograms contain also 256 values like HistogramValues. I want that in Histograms in index [0] there will be 256 values from HistogramValues then in [1] also 256 values then [2] and so on.
Histograms is a List
Upvotes: 0
Views: 132
Reputation: 12741
Sounds to me like you want a 2-dimensional array or nested Lists:
long[,] longArray = new long[16, 256];
List<List<long>> longList = new List<List<Long>>();
For the array you will have 16 columns each with 256 values. For the List implementation you can add as many as you want...likely longList[0] = new List<long>(256)
for your case but these lists are not bound in anyway.
Additional Resources:
Upvotes: 0
Reputation: 9660
A list of array of longs - List<long[]>
class Form1
{
public Form1()
{
this.Histograms = new List<long[]>();
}
public List<long[]> Histograms { get; private set; }
}
long[] histogramValues = Form1.GetHistogram(bitmap);
Form1.Histograms.Add(histogramValues);
Then you can access each histogram as such:
long[] fifthHistogram = Form1.Histograms[4];
Upvotes: 0
Reputation: 335
What you need is a list of arrays
List<long[]> Histograms = new List<long[]>();
And then add the arrays
long[] HistogramValues = Form1.GetHistogram(bitmap);
Form1.Histograms.Add(HistogramValues);
Upvotes: 5