Saxon API for .NET |

# Processor.RegisterCollection Method

Register a named collection. A collection is identified by a URI (the collection URI), and its content is represented by an `IEnumerable` that enumerates the contents of the collection. The values delivered by this enumeration are Uri values, which can be mapped to nodes using the registered `XmlResolver`.

public void RegisterCollection(
Uri collectionUri,
IEnumerable contents
);

#### Parameters

collectionUri
  The URI used to identify the collection in a call of the XPath `collection()` function. The default collection is registered by supplying null as the value of this argument (this is the collection returned when the XPath `collection()` function is called with no arguments).
contents
  An enumerable object that represents the contents of the collection, as a sequence of document URIs. The enumerator returned by this IEnumerable object must return instances of the Uri class.

#### Remarks

Collections should be stable: that is, two calls to retrieve the same collection URI should return the same sequence of document URIs. This requirement is imposed by the W3C specifications, but in the case of a user-defined collection it is not enforced by the Saxon product.

A collection may be "unregistered" by providing null as the value of the contents argument. A collection may be replaced by specifying the URI of an existing collection.

Collections registered with a processor are available to all queries and stylesheets running under the control that processor. Collections should not normally be registered while queries and transformations are in progress.

#### See Also

Processor Class | Saxon.Api Namespace