MarkLogic XCC/.Net Library |

# ResultSequence.ToResultItemArray Method

This method is identical to the superclass method ToArray(), but returns an array typed as ResultItem.

If the ResultSequence is streaming (Cached is false), then it is consumed and closed after building the returned array. Note also that AsStrings() when called on a ResultSequence will call this method internally, which will also result in the object being closed automatically.

Note that for a streaming ResultSequence, all items will be loaded into memory to build the array. If very large items (node(), text(), etc) are in the stream, it's possible that there may not be enough memory to buffer everything. If the sequence contains too much data to buffer, iterate over each item and use ResultItem.AsStream() to read each item in turn as a Stream.

[Visual Basic]
Function ToResultItemArray() As ResultItem()
[C#]
ResultItem[] ToResultItemArray();

#### Return Value

An array of ResultItem instances, all of which will be cached.

#### See Also

ResultSequence Interface | Marklogic.Xcc Namespace