469,927 Members | 1,912 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Inherited ArrayList doesn't show members on indexer.

I have the following problem. I derived a class from
ArrayList to provide some additional events I need. Then
I derived 2 different classes from this one and each of
them defines an indexer that returns the specified
object. For example, the list for Group types will have:

public new Group this[int index]
{
get
{return (Group)base[index];}
set
{base[index]=value;}
}

everything is fine, but if I do this:

someclass.Groups[0]. -> at this moment the members of the
Group object (returned by the indexer) do not show in the
intellisense drop down box. I know this is because the
ide "thinks" that the indexer returns the base item which
is object, or maybe because it doesn't know which one to
pick? However, this behaviour is pretty annoying and I
was wondering if anybody has any idea about what do I do
wrong?

Again, the list is derived directly from ArrayList and
then 2 different lists are derived from it and each list
implements the indexer that returns the required type.

Any help would be appreciated,
thank you!
Iulian
Nov 15 '05 #1
1 1483
Iulian,
How is the someclass variable defined?

Instead of deriving from ArrayList have you considered deriving from
System.Collections.CollectionBase instead?

CollectionBase contains an ArrayList internally yet allows you to define
fully functional type safe collections (new/shadows on methods not
required).

Hope this helps
Jay

"Iulian Ionescu" <iu************@world-link.net> wrote in message
news:33****************************@phx.gbl...
I have the following problem. I derived a class from
ArrayList to provide some additional events I need. Then
I derived 2 different classes from this one and each of
them defines an indexer that returns the specified
object. For example, the list for Group types will have:

public new Group this[int index]
{
get
{return (Group)base[index];}
set
{base[index]=value;}
}

everything is fine, but if I do this:

someclass.Groups[0]. -> at this moment the members of the
Group object (returned by the indexer) do not show in the
intellisense drop down box. I know this is because the
ide "thinks" that the indexer returns the base item which
is object, or maybe because it doesn't know which one to
pick? However, this behaviour is pretty annoying and I
was wondering if anybody has any idea about what do I do
wrong?

Again, the list is derived directly from ArrayList and
then 2 different lists are derived from it and each list
implements the indexer that returns the required type.

Any help would be appreciated,
thank you!
Iulian

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Bill Cohagan | last post: by
6 posts views Thread by thechaosengine | last post: by
4 posts views Thread by Bob Weiner | last post: by
7 posts views Thread by Steph | last post: by
3 posts views Thread by JJ | last post: by
2 posts views Thread by Walt Zydhek | last post: by
14 posts views Thread by lovecreatesbea... | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.