Assign array value to some variable,Array is populated
<p>ArrayList <code>USStates</code> is populated with the values as shown, but if I want to access these values within the array, how do I do it? Referencing through <code>USStates(1)</code> doesn't work. Can anyone explain this line of code?</p>

<pre><code>USStates.Add(new USState("Alabama", "AL"));
</code></pre>

<p>Full code:</p>

<pre><code>// Populate the list box using an array as DataSource.
ArrayList USStates = new ArrayList();
USStates.Add(new USState("Alabama", "AL"));
USStates.Add(new USState("Washington", "WA"));
USStates.Add(new USState("West Virginia", "WV"));
USStates.Add(new USState("Wisconsin", "WI"));
USStates.Add(new USState("Wyoming", "WY"));
ListBox1.DataSource = USStates;

// Set the long name as the property to be displayed and the short
// name as the value to be returned when a row is selected.  Here
// these are properties; if we were binding to a database table or
// query these could be column names.
ListBox1.DisplayMember = "LongName";
ListBox1.ValueMember = "ShortName";

public class USState
{
    private string myShortName;
    private string myLongName;

    public USState(string strLongName, string strShortName)
    {
        this.myShortName = strShortName;
        this.myLongName = strLongName;
    }

    public string ShortName
    {
        get
        {
            return myShortName;
        }
    }

    public string LongName
    {
        get
        {
            return myLongName;
        }
    }
}
</code></pre>
