|
-
Sep 24th, 2006, 11:03 PM
#1
Thread Starter
Hyperactive Member
question related to array
is there any way to find out that how many nodes of an array are filled with some value
for example if i have an array like
String[] strarr = new string[10];
and i have put some values in this array using some loop ... but i dnt know each time how many values would b moved in the array
now i wanna read the array to that point where the last value is stored
can i know this thing
in c#
plz help
Last edited by noshaba; Sep 24th, 2006 at 11:34 PM.
-
Sep 24th, 2006, 11:19 PM
#2
Fanatic Member
Re: question related to array
Use an ArrayList instead in VS2003, or a List<string> in VS2005. It dynamically resizes so you don't have to keep track of how many nodes are used.
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Sep 24th, 2006, 11:33 PM
#3
Thread Starter
Hyperactive Member
Re: question related to array
ok thnx but can u plz help me how could i declare List and fill it run time
sorry for bothering as m very new in C#
-
Sep 24th, 2006, 11:50 PM
#4
Re: question related to array
Don't use the ArrayList in either case. You can use List<string> in 2005 as suggested, or you can use a Specialized.StringCollection in any version. Let Intellisense guide you.
-
Sep 25th, 2006, 08:27 AM
#5
Re: question related to array
VB Code:
Dim sc As New StringCollection()
sc.Add("something")
There's also the option to use sc.Insert, which lets you insert at a specific position.
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
|