Skip to content

Instantly share code, notes, and snippets.

@nojaf
Created September 18, 2017 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nojaf/3a92866df908c686f72e835da464ad4f to your computer and use it in GitHub Desktop.
Save nojaf/3a92866df908c686f72e835da464ad4f to your computer and use it in GitHub Desktop.
yield!
/// <summary>Wraps this object instance into an IEnumerable<T> consisting of a single item.</summary>
/// <typeparam name="T"> Type of the object. </typeparam>
/// <param name="item"> The instance that will be wrapped. </param>
/// <returns> An IEnumerable<T> consisting of a single item. </returns>
public static IEnumerable<T> Yield<T>(this T item)
{
yield return item;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment