This simple example:

string[] a;
a[10] = "hello";

Gives me: core.exception.RangeError: Range violation

I know about this way:

string[] a;
a = new string[11];
a[10] = "hello";

But what if i need do this many times with the same array like this:

a[10] = "a";
...
a[1] = "b";
..
a[1000] = "c";

If i will call "a = new string[11]" all those many times, isn't this will be inefficient ? Also it will clear all previous contents of "a", which is not suitable.

Reply via email to