[Mono-list] mcs, indexer property and errors cs0654 and cs0131

Francisco Jr. fxjrlists@yahoo.com.br
Wed, 29 May 2002 21:14:02 -0300 (ART)


Hi all, I'd like you test the code below to see if you
get the same results as me.


using System;
using System.Collections;

public class Testmcs : ArrayList
{
	public static void Main(String[] args)
	{
		Testmcs al = new Testmcs();
		al.Add("Hello");
		al.Test();
		al.Test2();
	}

	public void Test()
	{
		Console.WriteLine(base[0]);
	}

	public void Test2()
	{
		base[0] = "World";
	}
}

In the Test() method, mcs gives me a cs0654 error
saying:

cs0654.cs(20) error CS0654: Method
`System.Collections.ArrayList.get_Item()' is
referenced without parentheses

in Test2(): 

cs0654.cs(26) error CS0131: Left hand of an assignment
must be a variable, a property or an indexer.

First, I'm sorry for showing two errors in a single
file. It is because I didn't want to fullfill the
message with two files almost identical.

Now, some observations...

If I change the lines with error from:

Console.WriteLine(base[0]); to:
Console.WriteLine(base.get_Item(0));

and

base[0] = "World"; to 
base.set_Item(0, "World");

mcs compiles it perfectly and it works!

I tested the code with mcs and it works.
I'm using the mono runtime from mono.baselabs.org rpm
date 20020524 on a Linux Mandrake.

Thanks.

Francisco Jr.





_______________________________________________________________________
Yahoo! Encontros
O lugar certo para você encontrar aquela pessoa que falta na sua vida. Cadastre-se hoje mesmo!
http://br.encontros.yahoo.com/