double[] wSeries = new double[wFingersPlusNotchesPlusOne];
for (int i = 0; i < wFingersPlusNotchesPlusOne; i++)
{
wSeries[i] = i * wActualFingerWidth;
}
This would be very useful in my component as a method.
But I cannot get it to work. I have a suspicion that it has something to do with the fact that I don’t specify how many elements my array contain.
double[ ] wSeries(int nr, double fingerWidth)
{
for (int i = 0; i < nr; i++)
{
wSeries[i] = i * fingerWidth;
}
return wSeries;
}
It seems you are trying to assign a value to the function itself instead of assigning an array (wSeries[i] = …) as if the function itself was the array. (But, thereäs no array at all in the function). A correctly designed function would look something like this instead:
double[ ] GetSeries(int nr, double fingerWidth)
{
double[] wSeries = new double[nr]; // create a new array
for (int i = 0; i < nr; i++)
{
wSeries[i] = i * fingerWidth;
}
return wSeries; // return that new array
}