G
Guest
Be aware that if you create a class named 'Item', you can't create an indexer
public class Item {
protected ArrayList _list = new ArrayList();
public string this[int index] {
return (string)_list[index];
}
}
It took me long time to figure this one out. It seems like the compiler
creates a method named 'Item' for indexers (under the hood) and the compiler
won't allow you the have a method or property with the same name as the class.
MS should change the error code for this one, making it easier to spot
public class Item {
protected ArrayList _list = new ArrayList();
public string this[int index] {
return (string)_list[index];
}
}
It took me long time to figure this one out. It seems like the compiler
creates a method named 'Item' for indexers (under the hood) and the compiler
won't allow you the have a method or property with the same name as the class.
MS should change the error code for this one, making it easier to spot