473,480 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Circular Collection?

Is there a predefined collection in .NET that allows you to index through
its values by simply using a "NextItem" function (where it keeps track of
the currently referenced item) and wraps around so that you return to the
first item after reaching the end? Or is this something I'll just have to
write myself?

Thanks,

Joel Moore

Jul 21 '05 #1
1 1074
> Is there a predefined collection in .NET that allows you to index through
its values by simply using a "NextItem" function (where it keeps track of
the currently referenced item) and wraps around so that you return to the
first item after reaching the end? Or is this something I'll just have to
write myself?

With such a collection, a forech loop would be an endless loop.
However, such a collection does currently not exist you have to write it
yourself, maybe not a whole collection but an Enumerator.

if you enumerate over a simple arraylist you can implement the MoveNext
method of the enumerator the following:

public void MoveNext()
{
if (index==arraylist.Count-1)
index = 0;
else
index++;
}

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Jul 21 '05 #2

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

Similar topics

2
7946
by: Earth Worm Jim | last post by:
I have been able to get simple circular references to be serialized in xml by using the ImportTypeMapping method on the SoapReflectionImporter class. But I am unable to serialise circular...
11
9024
by: Steve Jorgensen | last post by:
I just came up with a really tidy little solution to the VB/VBA circular reference issue. It only works with Access 2000 or newer, but that's about the only down-side. The issue... You need an...
1
3417
by: Guogang | last post by:
Hi, I have a tree structure in C# with pointer to children and parent. This will form a circular reference. My question: will this kind of circular reference affect garbage collection (parent...
12
7041
by: Frank Rizzo | last post by:
I have a circular reference between 2 classes in the same project (i.e. each class refers to the other). The app runs fine and I am seeing no issues, which kind of surprised me. Are there any...
1
292
by: Joel Moore | last post by:
Is there a predefined collection in .NET that allows you to index through its values by simply using a "NextItem" function (where it keeps track of the currently referenced item) and wraps around...
10
6330
by: Richard Lewis Haggard | last post by:
I've created in form that has tab controls that contain tab controls that host user controls on each tab page. It compiles and runs just fine but the designer view fails with a "A circular control...
4
3069
by: Matteo Migliore | last post by:
Hi. I've a problem with parent-child circular references. Suppose have two classes, Person and Course: -------------------------- public class Person{ public Person(string name, Course...
6
1839
by: Peter Michaux | last post by:
I just ran some circular memory leak tests in IE6, O9, S3, FF2 and it seems to me they all benefit from doing the same kind of circular memory leak cleanup that IE requires. My tests were very...
1
1194
balabaster
by: balabaster | last post by:
I have a database with two main tables, we'll call them A and B. The relationship between the two main tables is by nature a many-to-many relationship, so to normalize and avoid the many-to-many...
0
6908
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
7043
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
7081
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...
1
4776
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...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.