[Mono-list] compile problem and indexer resizing

Santiago Erquicia serquicia@fibertel.com.ar
Tue, 18 Feb 2003 00:49:37 -0300


I'm new to C# and programing in general.  I was trying to resize an index=
er=20
(by the way, does anybody know how to do that?) and when I tried to compi=
le=20
it, my CPU usage jumped to 98% and never ended.

This is the code:

=09class AccountList
=09{
=09=09private Account[] myAccounts;
=09=09private int last;

=09=09public AccountList(int length)
=09=09{
=09=09=09this.myAccounts =3D new Account[length];
=09=09}

=09=09/* Indexer */
=09=09public Account this[int index]
=09=09{
=09=09=09get
=09=09=09{
=09=09=09=09return myAccounts[index];
=09=09=09}
=09=09}

=09=09public int Add (Account account)
=09=09{
=09=09=09myAccounts[].Add(account);
=09=09=09return this.last;
=09=09}
=09}

Does anyone knows if this is wrong? If it is, shoudn't the compiler say=20
something?

Thanks,
Santiago