Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

collection and data type

Isn't there a way to declare a collection to hold a certain data type?  What the syntax?  
ASKER CERTIFIED SOLUTION
Avatar of nffvrxqgrcfqvvc
nffvrxqgrcfqvvc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HLRosenberger

ASKER

Can I add items into the list and specify a index value, like with collections?   And then retrieve the items using that index?
Avatar of Miguel Oz
As mentioned  by first comment above use a generic list, look at it as type safe collection:
Dim list As New List(Of String)
'Add items
list.Add("test 0")
' index access
Dim entry As String = list(0)
'Insert at index, be aware that index < count.
list.Insert(0,"test 0000")
Check:
http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx
http://www.vbdotnetheaven.com/UploadFile/Saurabh.Mishra/GenericsInCsharp211232006000706AM/GenericsInCsharp2.aspx


 
Thanks