Return.cs 849 B

12345678910111213141516171819202122232425
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. namespace System.Linq
  9. {
  10. public static partial class EnumerableEx
  11. {
  12. /// <summary>
  13. /// Returns a sequence with a single element.
  14. /// </summary>
  15. /// <typeparam name="TResult">Result sequence element type.</typeparam>
  16. /// <param name="value">Single element of the resulting sequence.</param>
  17. /// <returns>Sequence with a single element.</returns>
  18. public static IEnumerable<TResult> Return<TResult>(TResult value)
  19. {
  20. yield return value;
  21. }
  22. }
  23. }