Skip to content

Commit 5230479

Browse files
committed
+ DList.toArray
1 parent b699b08 commit 5230479

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/FSharpPlus/Data/DList.fs

+10
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,16 @@ module DList =
276276
coll.Close ()
277277
#endif
278278

279+
/// Returns an array of the DList elements.
280+
let toArray (source: DList<'T>) =
281+
#if FABLE_COMPILER
282+
source :> seq<'T> |> Seq.toArray
283+
#else
284+
let mutable coll = new ArrayCollector<_> ()
285+
iter (fun x -> coll.Add x) source
286+
coll.Close ()
287+
#endif
288+
279289
/// O(n). Returns a seq of the DList elements.
280290
let inline toSeq (l: DList<'T>) = l :> seq<'T>
281291

0 commit comments

Comments
 (0)