Class DocumentExtensions
Contains extension methods for Document<T>.
Inheritance
- object
- DocumentExtensions
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()
Declaration
public static class DocumentExtensions
Methods
SeparatedAndTerminated<T>(IEnumerable<Document<T>>, Document<T>)
Returns a Document<T> representing the items
in documents
concatenated together,
with separator
after each one.
Declaration
public static Document<T> SeparatedAndTerminated<T>(this IEnumerable<Document<T>> documents, Document<T> separator)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Document<T>> |
documents |
The documents to concatenate. |
Document<T> |
separator |
The document to place after each document. |
Returns
Type | Description |
---|---|
Document<T> |
A Document<T> representing the items
in |
Type Parameters
Name | Description |
---|---|
T |
The type of annotations in the document. |
Remarks
docs.SeparatedAndTerminated(sep)
is equivalent to
documents.Separated(separator).Append(separator)
.
Examples
var doc = new Doc[] { "item1", "item2", "item3" }
.SeparatedAndTerminated(",");
Console.WriteLine(doc);
// Output:
// item1,item2,item3,
Separated<T>(IEnumerable<Document<T>>, Document<T>)
Returns a Document<T> representing the items
in documents
concatenated together,
with separator
in between them.
Declaration
public static Document<T> Separated<T>(this IEnumerable<Document<T>> documents, Document<T> separator)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Document<T>> |
documents |
The documents to concatenate. |
Document<T> |
separator |
The document to place between each document. |
Returns
Type | Description |
---|---|
Document<T> |
A Document<T> representing the items
in |
Type Parameters
Name | Description |
---|---|
T |
The type of annotations in the document. |
Examples
var doc = new Doc[] { "item1", "item2", "item3" }
.Separated(",");
Console.WriteLine(doc);
// Output:
// item1,item2,item3