Storing many array values in a variable

Quick question. Is it possible to store multiple array values in a variable without having to specify each and every array value itself?

IE. from array[0] to array[30] = var X

I ask, because I am attempting to create a (simple) spectrum analyzer to manipulate my game objects via music.

From what I have researched I should use AudioListener.GetSpectrumData() – for the first int within that function I used 1024, splitting the spectrum into 1024 parts (I presume). I know I could go as low as 64, but I feel like the spectrum split wouldn’t really give me a nice visual manipulation. That and writing out 0 to 64 still seems like a pain in the ass. :stuck_out_tongue:

Thank you kindly!

Actually this is pretty simple while using List and Linq

do something like this,

    List<int> temp;
    temp = new List<int>();


this will fill the list with 128 items first 64 will be 1 and next 64 will be 3… this is one of the easiest available solutions.

if there are issues using list and the number of entries will always be the same ( i.e., 64), then you can just save the value once to an array like this

int[] temp; 
temp = new int[2];

temp[0] = 1;
temp[1] = 3;

and while retriving if u need 100th value in the array (assuming that there are 128 entries jus like the list example.) you can do something like


similarly for any array index values.

if the array size is varying and not 64 always, then you would have to manually write an function that fills the values.

public void FillMyArray(ref int[] arr,int startIndex, int count,int value)

   for(int i=0;i<count;i++)
      arr[i+startIndex] = value;


and while using the function,

	FillMyArray(ref temp,0,32,1);
	FillMyArray(ref temp,32,64,3);