I have declared an ArrayList
like this
Dim List1 As ArrayList = New ArrayList
Adding a ListItem
to it
Dim Item As String = ""
List1.Add(New ListItem(Item))
Is there is any limit how many characters the ListItem
can contain?
I have declared an ArrayList
like this
Dim List1 As ArrayList = New ArrayList
Adding a ListItem
to it
Dim Item As String = ""
List1.Add(New ListItem(Item))
Is there is any limit how many characters the ListItem
can contain?
"Is there is any limit how many characters Item can contains."
It's limited by the limit of the length of a String
and your memory.
The theoretical limit may be 2,147,483,647, but the practical limit is nowhere near that. Since no single object in a .Net program may be over 2GB and the string type uses unicode (2 bytes for each character), the best you could do is 1,073,741,823, but you're not likely to ever be able to allocate that on a 32-bit machine.
https://stackoverflow.com/a/140749/284240
Apart from that, always use a strongly typed List(Of ListItem)
instead of an ArrayList
.
Dim List1 = New List(Of ListItem)
List1.Add(New ListItem("Foo1"))