Skip to content

Dynamic array in c#

mohsin ahmad

mohsin ahmad

Asked Aug 3, 2012, 4:59 PM EDT1 answer
Share
LinkedInX
1:how to add values from user in array that is dynamic array we dont know how much values user will enter
2:after then sort that array
3:enter the element to remove from user
4:deleting all items

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    If you're writing in C# 3, you can do it with a one-liner: int[] terms = Enumerable.Range(0, 400).ToArray();
    This code snippet assumes that you have a using directive for System.Linq at the top of your file.
    On the other hand, if you're looking for something that can be dynamically resized, as it appears is the case for PHP (I've never actually learned it), then you may want to use a List instead of an int[].
    http://www.dapfor.com/en/net-suite/net-grid/tutorial/data-sorting
    0