ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

StartEnumerable

Creates an IEnumerable from a list of single entities in a Fluent-manner.

Source

public static IEnumerable<T> StartEnumerable<T>(this T item, params T[] objects) =>
objects.Prepend(item);

Example

class Workshop
{
	public IEnumerable<string> Participants { get; set; }
}

var workshop = new Workshop{
	Participants = "John"
		.StartEnumerable(
			"Bill",
			"Sam",
			"Mark")};

Author: Shai Cohen

Submitted on: 21 jan. 2021

Language: csharp

Type: any

Views: 3327