Dynamic Array Java program converted to C#
<p>The folowing program was orignally in java. But i still get 1 error with the program in C#.<br>
(the eror is listed in comment in the 2nd block of code).</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynArray
{
public class DynArrayTester
{
    static void Main(string[] args)
    {
        DynArray da = new DynArray(5);

        for (int i = 1; i &lt;= 7; i++)
        {
            da.setData(i, i);
            //da.put(0, 0);
            //da.put(6, 6);
        }
        Console.WriteLine(da);
    }

}/*DynArrayTester*/
}





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

 namespace DynArray
{
public class DynArray
{
    //toestand
    private int[] data;

    //gedrag
    public DynArray(int size)
    {
        data = new int[size];
    }

    public int getData(int index)
    {
        return data[index - 1];
    }

    private void expand(int size)
    {

        int[] tmp = data;
        data = new int[size];

        for (int i = 0; i &lt; tmp.Length; i++)
        {
            data[i] = tmp[i];
        }
    }/*expand*/

    public void setData(int index, int data)
    {
        if (0 &lt; index)
        {
            if (index &gt; this.data.length) // ***error, does not contain definition for "lenght" and no exetension method "lenght"***
                expand(index);

            this.data[index - 1] = data;
        }
    }

    public override string ToString()
    {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i &lt; data.Length; i++)
        {
            buf.Append("[" + i + "]");
            buf.Append(data[i]);
            buf.Append('\n');
        }
        return buf.ToString();
    }

}/*DynArray*/
</code></pre>

<p>}</p>
