Hi all,
in C# is it possible to change a dimension of an array?

Thanks a lot.

--
Luigi
http://blogs.dotnethell.it/ciupaz/

Re: Changind array dimension by Vadym

Vadym
Fri Jan 18 03:44:13 CST 2008

Hello, Luigi!

Array has Resize method. Is that suitable for you?

--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com

You wrote on Fri, 18 Jan 2008 01:18:01 -0800:

L> Hi all, in C# is it possible to change a dimension of an array?

L> Thanks a lot.

L> --
L> Luigi http://blogs.dotnethell.it/ciupaz/




Re: Changind array dimension by ciupazNoSpamGrazie

ciupazNoSpamGrazie
Fri Jan 18 03:58:00 CST 2008

"Vadym Stetsiak" wrote:

> Hello, Luigi!
>
> Array has Resize method. Is that suitable for you?
>
> --
> With best regards, Vadym Stetsiak.
>
Yes, like this:

string[] myArray = new string[4]{"Primo", "Secondo", "Terzo", "Quarto"};

Array.Resize(ref myArray, 2);

Thanks Vadym.

Luigi

RE: Changind array dimension by DavidAnton

DavidAnton
Sat Jan 19 10:27:01 CST 2008

To be clear, you are talking about the *size* of an array, not the dimension.
Dimension means something else for arrays (i.e., 1 dimension is more common,
2 dimension is a rectangular array, etc.). You can't change an array's
dimension - a 1 dimensional array cannot be changed to a 2 dimensional array.

The use of "dimension" when talking about array size is probably due to VB's
unfortunate use of "ReDim" (short for re-dimension, but actually used for
re-sizing), and this improper keyword naming is still inflicted on the
current generation of VB programmers ;)
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++ VB Edition: VB to C++/CLI
Instant C++ C# Edition: C# to C++/CLI


"Luigi" wrote:

> Hi all,
> in C# is it possible to change a dimension of an array?
>
> Thanks a lot.
>
> --
> Luigi
> http://blogs.dotnethell.it/ciupaz/

RE: Changind array dimension by DavidAnton

DavidAnton
Sun Jan 20 11:16:02 CST 2008

Wow - I just noticed that the C# debugger also calls array sizes "dimensions"
- I can't believe that this hasn't been corrected.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++ VB Edition: VB to C++/CLI
Instant C++ C# Edition: C# to C++/CLI


"David Anton" wrote:

> To be clear, you are talking about the *size* of an array, not the dimension.
> Dimension means something else for arrays (i.e., 1 dimension is more common,
> 2 dimension is a rectangular array, etc.). You can't change an array's
> dimension - a 1 dimensional array cannot be changed to a 2 dimensional array.
>
> The use of "dimension" when talking about array size is probably due to VB's
> unfortunate use of "ReDim" (short for re-dimension, but actually used for
> re-sizing), and this improper keyword naming is still inflicted on the
> current generation of VB programmers ;)
> --
> http://www.tangiblesoftwaresolutions.com
> C++ to C#
> C++ to VB
> C++ to Java
> Instant C#: VB to C#
> Instant VB: C# to VB
> Instant C++ VB Edition: VB to C++/CLI
> Instant C++ C# Edition: C# to C++/CLI
>
>
> "Luigi" wrote:
>
> > Hi all,
> > in C# is it possible to change a dimension of an array?
> >
> > Thanks a lot.
> >
> > --
> > Luigi
> > http://blogs.dotnethell.it/ciupaz/