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 8067301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:14:47+00:00 2026-06-05T12:14:47+00:00

I need a dynamic length data structure with the capability of changing the element

  • 0

I need a dynamic length data structure with the capability of changing the element values.
The order of the elements is not important.

  • If I use an array I can modify my elements, but I have problems with the length. The solution is to create a new array of the correct size and copy all the elements into the new one each time. Not a great idea because the number of elements changes often.

  • It’s better to use a generic list, but the modify process is really complicated: first of all I need to remove the element I want to change- the generic list doesn’t seem to have a simple “Remove”/”Delete” method, so I tried the “Filter” one- then add the modified element to the head. It works but it’s a bit too complicated for something so easy.

Is there a data structure that allows me to dynamically change the length and modify the elements such as a modifiable list or a dynamically-sized array?

  • 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-06-05T12:14:49+00:00Added an answer on June 5, 2026 at 12:14 pm

    Use ResizeArray. It’s an abbreviation for the CLI type List(T) which offers the features you require, like Remove for example.

    From MSDN Library:

    The List(T) class is the generic equivalent of the ArrayList class. It
    implements the IList(T) generic interface using an array whose size is
    dynamically increased as required.

    Methods such as Contains, IndexOf, LastIndexOf, and Remove use an
    equality comparer for the list elements. The default equality comparer
    for type T is determined as follows. If type T implements the
    IEquatable(T) generic interface, then the equality comparer is the
    Equals(T) method of that interface; otherwise, the default equality
    comparer is Object.Equals(Object).

    Methods such as BinarySearch and Sort use an ordering comparer for the
    list elements. The default comparer for type T is determined as
    follows. If type T implements the IComparable(T) generic interface,
    then the default comparer is the CompareTo(T) method of that
    interface; otherwise, if type T implements the nongeneric IComparable
    interface, then the default comparer is the CompareTo(Object) method
    of that interface. If type T implements neither interface, then there
    is no default comparer, and a comparer or comparison delegate must be
    provided explicitly.

    The List(T) is not guaranteed to be sorted. You must sort the List(T)
    before performing operations (such as BinarySearch) that require the
    List(T) to be sorted.

    Elements in this collection can be accessed using an integer index.
    Indexes in this collection are zero-based.

    List(T) accepts a null reference (Nothing in Visual Basic) as a valid
    value for reference types and allows duplicate elements.

    An example in F#:

    open System
    
    // an integer list
    let intList =
        let temp = new ResizeArray<int>() in
        temp.AddRange([| 1; 2; 3 |]);
        temp
    
    // print each int using the ForEach member method
    intList.ForEach( fun i -> Console.WriteLine(i) )
    
    // unpack items from the resize array
    let itemOne = intList.Item(0)
    let itemTwo = intList.[1]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a dynamic array in Java, but the values type differ
I have a fixed-length data file need to persistence into database. I use a
I need to write data into a structure where the length of the data
I need to transfer packets through the internet whose length should be dynamic. struct
I need to used dynamic order query in mysql and i have successfully achieved
I need to add dynamic controls and get its values in my asp.net mvc
The normal dynamic array supports empty (= nil, Length() = 0) . The variant
I need a multidimensional array of chars that is dynamic in only one dimension...
I need to have a dynamic URL preferably from a Test Class. Can any
I need to build a dynamic linq query with or operators. I have seen

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.