Method Return
| Edit this page View SourceReturn<T>(T)
Returns a single-element sequence containing the item provided.
Declaration
public static IEnumerable<T> Return<T>(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to return in a sequence. |
Returns
Type | Description |
---|---|
IEnumerable<T> | A sequence containing only |
Type Parameters
Name | Description |
---|---|
T | The type of the item. |
Examples
The following code example demonstrates how to return a single element as a sequence using Return
.
// Return a sequence of a single element
var result = SuperEnumerable.Return(123);
Console.WriteLine(
"[" +
string.Join(", ", result) +
"]");
// This code produces the following output:
// [123]