|
-
Jul 22nd, 2008, 10:58 AM
#1
Thread Starter
Member
Better alternative than arrays?
I'm using arrays because I have to deal with lists of items. I can't think of another alternative. Anyone know of one?
-
Jul 22nd, 2008, 11:52 AM
#2
Re: Better alternative than arrays?
What about a control list a ListView or a ListBox?
-
Jul 22nd, 2008, 12:23 PM
#3
Fanatic Member
Re: Better alternative than arrays?
If Hack's answer isn't sufficient could you give us some more information about what you're doing or maybe some code? I think your best alternative is generic lists... List<T>
C#.net, VB, C++, Java, VS 2005/2008
Dont' forget to rate posts that are helpful to you.
-
Jul 22nd, 2008, 01:00 PM
#4
Re: Better alternative than arrays?
You'll have to provide much more information for us to give a good answer. For instance, why arent arrays sufficient for you? What are you storing?
-
Jul 24th, 2008, 11:18 AM
#5
Thread Starter
Member
Re: Better alternative than arrays?
Basically, I'm handling and comparing file lists from directories. One list is a recorded old, the other is newly scanned. My process performs an operation if the new conflicts with the old.
Mind you, these directories contain log files generated from processes that error out from time to time, usually one file out out of a period of 2-3 weeks.
-
Jul 24th, 2008, 12:42 PM
#6
Fanatic Member
Re: Better alternative than arrays?
I still don't think you're giving us enough to help you...
Can you give us an example of a run of your program, or at least what you want it to do? It it comparing two "file lists" that are lists of the file's location or of its contents? And can you elaborate on "My process performs an operation if the new conflicts with the old". What exactly does that mean? Does conflict mean it contains the same or different information? And is that the file name or the contents?
It might be just me but the descriptions given so far are much too vague to give any valuable feedback.
C#.net, VB, C++, Java, VS 2005/2008
Dont' forget to rate posts that are helpful to you.
-
Jul 24th, 2008, 10:24 PM
#7
Re: Better alternative than arrays?
An array is the most efficient way to store references to multiple objects of the same type such that you can enumerate the list or access individual items by numeric index. If that's what you want to do then arrays are most likely what you should use, assuming that the number of items in the list remains the same. You'll find that Directory.GetDirectories, Directory.GetFiles and the corresponding members of DirectoryInfo already return arrays.
If your list changes size or accessing via a numeric index is not sufficient, then you need to look at some of the members of the System.Collections.Generic namespace, like List<T> and Dictionary<TKey, TValue>.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|