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
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.
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# :(
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.
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.