Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Fortran

Idiom #227 Copy a list

Create the new list y containing the same elements as the list x.

Subsequent modifications of y must not affect x (except for the contents referenced by the elements themselves if they contain pointers).

type (foo), allocatable, dimension(:) :: y
y = x

Assuming x is of type(foo).
List<T> y = x.ToList();

Using LINQ

New implementation...
< >
programming-idioms.org