Iterating over list via foreach.
LinkedList!int list; scope(exit) list.free(); list.append(1); list.append(2); list.append(3); list.append(4); int[] values; foreach(ref int val; list) { values ~= val; } assert(values[] == [1,2,3,4]);
See Implementation
Iterating over list via foreach.