Generation refers to creating a new sequence of values.
DefaultIfEmpty
Replaces an empty collection with a default valued singleton collection.
Method Syntax
// DefaultIfEmpty
var nums = new int[0];
var numbers = nums.DefaultIfEmpty();
// numbers = { 0 }
Query Syntax
// Not applicable.
Empty
Returns an empty collection.
Method Syntax
// Empty
var empty = Enumerable.Empty<string>();
// empty = IEnumerable<string> { }
Query Syntax
// Not applicable.
Range
Generates a collection that contains a sequence of numbers.
Method Syntax
// Range
var range = Enumerable.Range(1, 5);
// range = { 1, 2, 3, 4, 5 }
Query Syntax
// Not applicable.
Repeat
Generates a collection that contains one repeated value.
Method Syntax
// Repeat
var repeats = Enumerable.Repeat("s", 3);
// repeats = { "s", "s", "s" }
Query Syntax
// Not applicable.