Hi all,
Can I assume that when I loop throw a Collection, List, IList,
ICollection, ... by using foreach, I first get the element of index 0,
then index 2, and so on until the last one ?
Thanks for your answers,
Dansk. 3 7754
No... It would go index 0 then index 1, index 2, so on.....
"Dansk" <da***@laouilest.frwrote in message
news:Ot**************@TK2MSFTNGP04.phx.gbl...
Hi all,
Can I assume that when I loop throw a Collection, List, IList,
ICollection, ... by using foreach, I first get the element of index 0,
then index 2, and so on until the last one ?
Thanks for your answers,
Dansk.
Dansk wrote:
Hi all,
Can I assume that when I loop throw a Collection, List, IList,
ICollection, ... by using foreach, I first get the element of index 0,
then index 2, and so on until the last one ?
Thanks for your answers,
Dansk.
Yes, you can expect this. This is an elementary requirement of the enumerator functionality.
--
Try Code-Navigator on http://www.codenav.com
a source code navigating, analysis and developing tool.
It supports following languages:
* C/C++
* Java
* .NET (including CSharp, VB.Net and other .NET components)
* Classic Visual Basic
* PHP, HTML, XML, ASP, CSS
* Tcl/Tk,
* Perl
* Python
* SQL,
* m4 Preprocessor
* Cobol
Thank you for your answers, they really make sense to me.
Dansk a écrit :
Hi all,
Can I assume that when I loop throw a Collection, List, IList,
ICollection, ... by using foreach, I first get the element of index 0,
then index 2, and so on until the last one ?
Thanks for your answers,
Dansk.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: hman |
last post by:
Hi,
I have a collection class where I've implemeneted the
ICollection Interface.
Here is a small code segment.
public class PageList : ICollection, IComparer,
IEnumerable, IList
{
|
by: cody |
last post by:
What about an enhancement of foreach loops which allows a syntax like that:
foeach(int i in 1..10) { } // forward
foeach(int i in 99..2) { } // backwards
foeach(char c in 'a'..'z') { } // chars...
|
by: ad |
last post by:
Hi,
When I studied CSharp, I am confuse by IList, Collection and Array.
What is the relationships between them?
|
by: rodchar |
last post by:
hey all,
Dim _oItems As Outlook.Items
Dim oInbox As Outlook.MAPIFolder =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
_oItems = oInbox.Items
I can iterate thru this with a...
|
by: Steve Barnett |
last post by:
I have a collection which I need to navigate through in several different
ways. Is there any way to structure my class such that I can have several
different iterators?
Ideally, I'd like to do...
|
by: Jimp |
last post by:
Why can't I cast List<MyObject> to ICollection<IMyObject>.
MyObject implements IMyObject, and of course, List implements
ICollection.
Thanks
|
by: Chuck Cobb |
last post by:
I'm having a problem converting an array to a collection. The code I'm
using looks like the following:
CustomerInfo cArray;
Collection<CustomerInfo> cCollection = new...
|
by: Michael Primeaux |
last post by:
What is the recommended pattern for implementing a synchronized
(thread-safe) class that inherits from Collection<T>? For example, I want
to implement a SyncRoot property . I do see where I can...
|
by: Doug |
last post by:
Hi,
I want to create a collection of objects that will be used as a
property of another object. So for example if I had a Customer object,
I would like to have an AddressCollection property...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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...
| | |