Hello, Happy new year!
I need help with collections. I have an array of a class (all the same type of course), but I think an arraylist would better fit my needs, the problem is that the arraylist is a collection of objects and I want it to be a collection of the type of my class cList. because when I want to call a method or a property in the class I have to cast everytime to the type I want, Is there a way to cast the arraylist to know that the type will be always the same, something like (im dreaming...): Dim X as Arraylist of cList
Is there a way to do it, or another type of colection that can help??
Thanks,
Ronq.
I need help with collections. I have an array of a class (all the same type of course), but I think an arraylist would better fit my needs, the problem is that the arraylist is a collection of objects and I want it to be a collection of the type of my class cList. because when I want to call a method or a property in the class I have to cast everytime to the type I want, Is there a way to cast the arraylist to know that the type will be always the same, something like (im dreaming...): Dim X as Arraylist of cList
Is there a way to do it, or another type of colection that can help??
Visual Basic:
'With arrays
Dim x() as cList
redim x(0)
x(0)=new clist
x(0).text="Hello"
'With arraylist
Dim x as new arraylist
x.add(new clist)
DirectCast(x.item(0),clist).text="Hello"
'I don't want to do the casting every time i use x.
Thanks,
Ronq.