473,414 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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 1626
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bill Cohagan | last post by:
I'm trying to figure out the "best" way to implement a strongly typed ArrayList. Using inheritance is one approach. It has the advantage that I only have to write overrides for the Add method and...
6
by: thechaosengine | last post by:
Hi all, Is there a way to hide a member in a subclass that has been inherited from a base class? Lets leave aside any issues regarding whether its a good idea for a moment. Here's an example...
4
by: Bob Weiner | last post by:
What I want to be able to do is create an indexer that can index into an ArrayList filled with objects of my own type. I have the following class structure: ...
7
by: Steph | last post by:
I'm learning C#. I need to implement an indexer using an array list. I have the following code and I'm getting an error "Inconsistent accessibility: indexer return type CRegs is less accessible...
3
by: JJ | last post by:
Hi, I have created an Arraylist object from an Arraylist class. I added rows to the arraylist object and I need to find a particular record in my arraylist. How do I do this? Also if I was in...
6
by: Peter Oliphant | last post by:
I just discovered that the ImageList class can't be inherited. Why? What could go wrong? I can invision a case where someone would like to add, say, an ID field to an ImageList, possible so that...
2
by: Walt Zydhek | last post by:
Could someone tell me how to Change the parameter type for an override of an inherited class member? In particular, I would like to change an indexer for my class that implements the IList class....
14
by: lovecreatesbea... | last post by:
Could you tell me how many class members the C++ language synthesizes for a class type? Which members in a class aren't derived from parent classes? I have read the book The C++ Programming...
8
by: Guy | last post by:
Is there a better way to search identical elements in a sorted array list than the following: iIndex = Array.BinarySearch( m_Array, 0, m_Array.Count, aSearchedObject ); aFoundObject= m_Array;...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.