Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7645273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:53:57+00:00 2026-05-31T09:53:57+00:00

In VB.NET I would like to create a complicated data structure with multiple types

  • 0

In VB.NET I would like to create a complicated data structure with multiple types of data stored in an array like format (see below).

I am trying to create a data structure that would look something like this:

[Name; xLoc; yLoc; zLoc; [Jagged Array]]

Note: Name needs to be dimensioned as a string, xLoc and so forth as integers.
The Jagged Array would look like this:

[Array1;Array2;...]

Each Array within would look like:

[xVel; yVel; zVel]

Note: Each value in the above vector would be an integer.

An example of this data structure with data in it might look like this:

[Ship1; 15; 16; 25; [[2;3;0];[5;0;7];[6;2;1]]]

Essentially I want to create a jagged array with multiple types of data stored in the same structure. Does VB.NET support this kind of structure in any way? I am not very experienced with VB.NET so there might very well be a much more efficient way to structure the data that would do the same thing in VB. Please feel free to comment with any ideas or critiques.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:53:58+00:00Added an answer on May 31, 2026 at 9:53 am

    You could use the System.Collections.Generic.List(Of Object), but you need to keep track of what the types are when you retrieve the values from the list.

    Out of curiosity, why do you want to store different types together in the same list?

    To use System.Collections.Generic.List

    Dim x as new List(of Object)()
    
    x.Add(element) 'given an element, all objects inherit from Object
    x.Add(new Int32({1,2,3,4,5})
    x.AddRange(array) 'append an array's contents
    
    Dim retrievedValue as int32() = x(1) ' here, I needed to remember what I stored at what indice.
    

    To make things easier, I would generally not do this kind of thing. You lose type safety and need to implicitly cast the value retrieved, but if you want to it can be done in the language.

    I would think about how I could write a class that would represent the data I am working with. If a class is too heavyweight, perhaps a few strongly-typed Dictionary() objects that share keys to store say int32() and strings in a string_map and int_array_map respectively.

    For instance, a Dictionary stores elements in KeyValuePairs, which can be strongly typed.

    Dim dict as new Dictionary(of string, List(of int32))()
    dict.Add('myname', new List(of Int32)({1,2,4,5,6,7})
    

    So dict('myname') retrieves a strongly typed list of Int32.

    I’m really just stabbing in the dark here, but you can see there are several useful collections classes in .NET. I’d recommend reading into the System.Collections.Generic namespace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ASP.NET newbie here. I would like to create a form with multiple types of
I'm trying to create a .NET touchscreen application. I would like to be able
I would like to create a console program in VB.net that would allow parameters.
I would like create a web service in ASP.Net 2.0 that will supports JSON.
I would like to create the ASP.NET User database template on a database of
In C# ASP.Net, I would like to create and save a text file to
I have two different .Net projects, hosted on github. I would like to create
I would like to create an ASP.NET MVC web application which has extensible logic
In .NET 3.5, I would like to create a custom attribute (say [NetDataMember]) that
I create .NET applications for a mid-sized manufacturing company. I would like to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.