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

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 1073
> 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
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
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
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
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
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
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
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
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
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
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
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
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...

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.