Array element to variable


I have created an array by the following way:

var config 	= new Array();
var ind : int = 0;
sr = new File.OpenText(configPath);
	input = "";
	while (true)
		input = sr.ReadLine();
		if (input == null) 

The array is filled with integers. How can I assign the value of the third element to a variable? I have tried the following way, but it gives me a “Cannot cast from source type to destination type.” error.

var volume : int = config[2];

Any ideas how should I do it?

The array is filled with integers.

It’s not, it’s filled with strings. Anyway, use List instead of Array, and convert the strings to integers.

var config = new List.<int>();