dynamic public array

May 27 2010 11:52 PM
I would like to declare a public array to be used across my solution.
namespace SolutionName
{
     internal class Input
    {
        public int arraySize = Convert.ToInt16(ConfigurationManager.AppSettings.Get(("size")));
        public in[] array = new double[arraySize , 1];
    }
}

I get the following error:
A field initializer cannot reference the non-static field, method, or property 'SolutionName.Input.arraySize'

My goal is to allow the user to dictate the size of "array" via the web config file.  Any suggestions?





Answers (6)