473,396 Members | 1,797 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,396 software developers and data experts.

collectionbase.item

When creating a collection class that inherits CollectionBase what advantage
is there for the Item property returning CType(List.Item(index),
<objecttype> ) over List.Item(index).

Looking at the help file I guess speed and that's a good thing but what is
the point when if you use "for each ... next" the Item property is NOT used.

Surely most collections are accessed via "for each ... next" as opposed to
"for nItem = 0 to nItems". Am I wrong?

Is there a way to strongly type the return type in the "for each .... next"
routine?

Tim
Nov 21 '05 #1
4 1383
Hello Tim,

Override the indexer?
When creating a collection class that inherits CollectionBase what
advantage is there for the Item property returning
CType(List.Item(index), <objecttype> ) over List.Item(index).

Looking at the help file I guess speed and that's a good thing but
what is the point when if you use "for each ... next" the Item
property is NOT used.

Surely most collections are accessed via "for each ... next" as
opposed to "for nItem = 0 to nItems". Am I wrong?

Is there a way to strongly type the return type in the "for each ....
next" routine?

Tim

Nov 21 '05 #2
Hello Tim,

Override the indexer?
When creating a collection class that inherits CollectionBase what
advantage is there for the Item property returning
CType(List.Item(index), <objecttype> ) over List.Item(index).

Looking at the help file I guess speed and that's a good thing but
what is the point when if you use "for each ... next" the Item
property is NOT used.

Surely most collections are accessed via "for each ... next" as
opposed to "for nItem = 0 to nItems". Am I wrong?

Is there a way to strongly type the return type in the "for each ....
next" routine?

Tim

Nov 21 '05 #3
I need a more info. CollectionBase does not have an Indexer method.

"Hayato Iriumi" <hi*****@hotmail.com> wrote in message
news:31*********************@news.microsoft.com...
Hello Tim,

Override the indexer?
When creating a collection class that inherits CollectionBase what
advantage is there for the Item property returning
CType(List.Item(index), <objecttype> ) over List.Item(index).

Looking at the help file I guess speed and that's a good thing but
what is the point when if you use "for each ... next" the Item
property is NOT used.

Surely most collections are accessed via "for each ... next" as
opposed to "for nItem = 0 to nItems". Am I wrong?

Is there a way to strongly type the return type in the "for each ....
next" routine?

Tim


Nov 21 '05 #4
I need a more info. CollectionBase does not have an Indexer method.

"Hayato Iriumi" <hi*****@hotmail.com> wrote in message
news:31*********************@news.microsoft.com...
Hello Tim,

Override the indexer?
When creating a collection class that inherits CollectionBase what
advantage is there for the Item property returning
CType(List.Item(index), <objecttype> ) over List.Item(index).

Looking at the help file I guess speed and that's a good thing but
what is the point when if you use "for each ... next" the Item
property is NOT used.

Surely most collections are accessed via "for each ... next" as
opposed to "for nItem = 0 to nItems". Am I wrong?

Is there a way to strongly type the return type in the "for each ....
next" routine?

Tim


Nov 21 '05 #5

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

Similar topics

2
by: m.pollack | last post by:
Hi all, I have an application which uses a class object that contains a collection. In order to use the PropertyGrid control to expose properties to the user at runtime, I created a...
2
by: Colin Basterfield | last post by:
Hi, I have a list which is derived from CollectionBase, and it contains a list of User objects, which I want to Serialize out to an XML file. Is there anywhere where I can find how to decode...
1
by: Mike Pollett | last post by:
Hi, I have used the ISerializable interface before and the code below worked fine. Until I derived it from CollectionBase. The code will still serialize and deserialize the properties in this class...
3
by: jason | last post by:
Hello. I've got this simple collection populate code I downloaded from the net (sorry can't find source now) I'm trying to test, but I can't seem to get it to work. Any help would be greatly...
1
by: Matthew Roberts | last post by:
Howdy Everyone, I am having trouble understanding the process of creating a type-safe collection by inheriting from the CollectionBase class. I have done it plenty of times, but now that I sit...
1
by: Kyle Novak | last post by:
I have a question about strongly typed objects when looping through a collection based on the CollectionBase object and using a For..Each loop. I have 2 objects: -Invoice: Holds all properties...
4
by: dotnw | last post by:
If the answer is "to make strongly typed collections", then I can do this with an ArrayList by taking advantage of the Shadows keyword, as follows: Public Class clsMyClass Inherits...
2
by: GoCoogs | last post by:
I'm trying to count how many items are in a dynamic collection. This is the code I have so far. *** Begin Code *** Public Class Rule Private _rulevars As RuleVarsCollection Private _rulename...
0
by: LIJO CHEERAN | last post by:
Hello friends I am trying to study about CollectionBase. I have inherited CollectionBase in the class TheCollection.cs. I am using the “TheCollection. in an aspx page to store objects...
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
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.