Multi Dimension Arrays

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SouthSpawn

    Multi Dimension Arrays

    If I have an array that is
    string[,] MyArray = new string[1,1]

    Then I do the following.

    string[0,0] = "A";

    How can I "ReDimensio n" my multi dimension array?

    In VB.Net they have the ReDim Keyword.

    Thanks,
    Mark

  • Jon Skeet [C# MVP]

    #2
    Re: Multi Dimension Arrays

    SouthSpawn <southspawn@aol .com> wrote:[color=blue]
    > If I have an array that is
    > string[,] MyArray = new string[1,1]
    >
    > Then I do the following.
    >
    > string[0,0] = "A";
    >
    > How can I "ReDimensio n" my multi dimension array?
    >
    > In VB.Net they have the ReDim Keyword.[/color]

    Arrays are of a fixed size in .NET - even VB.NET basically just creates
    a new array and copies the contents of the old array into it. You just
    need to do it explicitly in C#.

    Have a look at Array.Copy, which should help you.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    Working...