deriving from SortedList? 
Author Message
 deriving from SortedList?

When I derive from SortedList I want to make it typesafe...

class MySortedList : SortedList
{
    public void Add(string key, MyItem item)
    {
        base.Add(key, item);
    }

Quote:
}

so I make my own version of add that specifically takes a MyItem

but how can I hide all the other add methods so that I can be sure
that only MyItems are in this collection?

also when I try to use my derived class like

foreach (MyItem i in mySortedList)
{

Quote:
}

I get a convertion error on that line? is there any way i can make
thid work too????

should I just create a class that has a sorted list for a member
insted of deriving from it? that seems like the easy way out... i want
to provide direct access to all the members of the SortedList class
but...



Wed, 28 Jul 2004 03:48:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. SortedList Collection

2. Odd problem with System.Collections.SortedList

3. SortedList, searching for items efficiently

4. SortedList with duplicate items?

5. SortedList sorted by value.

6. SortedList!!

7. Please Help with SortedList!!!

8. SortedList, Why Parenthesis instead of Brackets?

9. Collections.SortedList

10. SortedList Key as DateTime Class?

11. New Class derived from Class which derived from CWindowImpl

12. Derived Interface implemented in derived class not found

 

 
Powered by phpBB® Forum Software