C# unassigned local variable error
<p>I am new to C#. I am trying to complile the following program but it throws an error given at the end: I know I am making a silly mistake. Any help would be much appreciated:</p>

<p>static void Main(string[] args)
        {</p>

<pre><code>        IntPtr hCannedMessages = CannedMessagesInit();

        using (StreamReader sr = new StreamReader(CANNED_MESSAGE_FILE))
        {
            String line, sub;
            all_integer_IDs[] myobjarray;// = new all_integer_IDs[10];
            for (int c = 0; c &lt; 10; c++)
            {
                myobjarray[c] = new all_integer_IDs();

            }
                line = sr.ReadLine();
                Console.WriteLine(line);

                if (line.Length &gt; 15)
                {
                     sub = line.Remove(line.IndexOf(' ', 2));
                     Console.WriteLine("{0} \n",sub);

    myobjarray[0].setvalues((int)sub[2], (int)sub[3], (int)sub[4], (int)sub[5]);
</code></pre>

<p>Console.WriteLine("{0}, {1}, {2}, {3}", myobjarray[0].m_messageID, myobjarray[0].m_messagetype, myobjarray[0].m_classID, myobjarray[0].m_categoryID);
                    }</p>

<pre><code>               Console.Read();
            sr.Close();
        }

    }
}
</code></pre>

<p>}</p>

<p>And the class is in Class1.cs file in the same project and is as follows:</p>

<p>public class all_integer_IDs 
    {</p>

<pre><code>    public all_integer_IDs() 
    {

        setvalues(0, 0, 0, 0);

    }

    ~all_integer_IDs()
    {
    }

    public void setvalues (int messageID, int messagetype, int classID, int categoryID)
    {
        this.m_messageID = messageID;
        this.m_messagetype = messagetype;
        this.m_classID = classID;
        this.m_categoryID = categoryID;
    }

     public int m_messageID;
     public int m_messagetype;
     public int m_classID;
     public int m_categoryID;

}
</code></pre>

<p>The error is as follows:
Use of unassigned local variable 'myobjarray' at line 55 which is copied and pasted below:
myobjarray[c] = new all_integer_IDs();</p>

<p>Thanks, Viren</p>
