Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Arrays inside array? VB.NET

So I want to store four values <DOMAIN> <IP> <PORT> <RESOURCE> and place them into an array. However, I want all four of those values to have a single index in the array, where i can call each of the values individually from said index. I will be adding many of these "four value" entries in the main array.

Sort of like: Dim demo_Value As String = myArray.Index(0).Item(3)

Is this possible? I feel like this would work similarly to a Python dictionary but I'm not sure.
I think what you're referring to here in terms of an "Array inside an array" is a 2 dimensional array. Just try googling Array dimensions and you'll find Microsoft's learning page on it for VB.

If it were me though I would just create an class object with those 4 attributes and create a collection of those objects. the you can access them exactly as you need to and it would be far easier to read.

Hope this helps!
^the correct answer
but if you're not implementing logic on the data itself, then a simple struct will suffice over a full class
(Jun 8, 2023 04:00 PM)Faith Connors Wrote:  ^the correct answer
but if you're not implementing logic on the data itself, then a simple struct will suffice over a full class

yah good point - struct will also work.
(Jun 8, 2023 03:53 PM)padrino Wrote:  I think what you're referring to here in terms of an "Array inside an array" is a 2 dimensional array. Just try googling Array dimensions and you'll find Microsoft's learning page on it for VB.

If it were me though I would just create an class object with those 4 attributes and create a collection of those objects. the you can access them exactly as you need to and it would be far easier to read.

Hope this helps!

(Jun 8, 2023 04:00 PM)Faith Connors Wrote:  ^the correct answer
but if you're not implementing logic on the data itself, then a simple struct will suffice over a full class

Thank you both for the help! I figured there was a fix but I was having trouble locating the solution. Cheers 😎
(Jun 8, 2023 04:14 PM)pzychonaut Wrote:  Thank you both for the help! I figured there was a fix but I was having trouble locating the solution. Cheers 😎

no problem mate - happy coding!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by EmacsSucksButILikeItJun 4, 2022 11:03 PM 1 222 Jun 4, 2022 11:03 PM
Last Post: unazed
[Java] by PsychoJul 3, 2021 11:15 PM 24 1,975 Jul 3, 2021 11:15 PM
Last Post: Lookdadon
[C#] by antibiotic1Sep 1, 2020 08:02 PM 4 229 Sep 1, 2020 08:02 PM
Last Post: Accord