473,406 Members | 2,633 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,406 software developers and data experts.

SortedList<> and SortedDictionary<>


Why does the generic SortedList and generic SortedDictionary not define any
virtual members?

Thanks,
Michael
May 14 '06 #1
1 4693
"Michael Primeaux" <mj********@msn.com> wrote:
Why does the generic SortedList and generic SortedDictionary not define any
virtual members?


The classes in the System.Collections.Generics namespace are designed to
be efficient for users who need them to be efficient. Non-virtual
methods are easier to inline (usually it is impossible to inline virtual
method calls) and are faster to call (less indirections are needed).

It's generally recommended that you use composition rather than
inheritance to get extra collection behaviours. You can still implement
IDictionary, IList and friends to support polymorphic behaviour where
required.

System.Collections.ObjectModel has some containers more suitable for
inheritance.

-- Barry
May 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Doug Holland | last post by:
Hey there Simple question, has the SortedDictionary<K, V> gone away now? In the latest build of Visual Studio 2005 publically available, this class seems to have disappeared. Thanks in...
2
by: ESPNSTI | last post by:
Hi, I'm trying to use a generics dictionary with a key class that implements and needs IComparable<>. However when I attempt to use the dictionary, it doesn't appear to use the IComparable<> to...
0
by: Adam | last post by:
Hi I split aspx for 1. aspx - www 2. vb But i have problem because Statement is not valid in a namespace. I don't know while this don't power becouse befor split wab all OK Please Help Me...
5
by: Brett Romero | last post by:
I'd like to type a SortedList as very generic on class instantiation: SortedList<T, T> _sl; Then in two particular methods of the class that is called first(of which only one or the other is...
4
by: Dave Booker | last post by:
So did the .NET 2.0 working group just run out of steam before it got to a ReadOnlyDictionary<> wrapper? I am publishing events containing a SortedList<>, and obviously I don't want event...
1
by: Eran | last post by:
Hi, I have a huge data structure, which I previosly stored in a Dictionary<int, MyObj> MyObj is relatively small (2 int, 1 DateTime, 1 bool). The dictionary I am using is quite large...
3
by: Beorne | last post by:
I have to retrieve the first kei I have inserted in a Dictionary<int,intcalled dict. The only method I found is: Dictionary<int,int>.KeyCollection.Enumerator dke = dict.Keys.GetEnumerator();...
2
by: Bruce Wood | last post by:
SortedList<Tgeneric has most of the methods of the old SortedList class, but it's missing a few, and one in particular that puzzles me. Anyone know why it has no GetByIndex method? It has...
0
by: Marc Gravell | last post by:
Well, I'd have to wonder why you don't just use Dictionary<,/ SortedList<,/ SortedDictionary<,(and just use .Keys and .Values) But something like below: List<KeyValuePair<DateTime, double>list...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...

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.