From e43a7200c68051ee4c82fd3dc0abab14bcfb9caf Mon Sep 17 00:00:00 2001 From: Drew Tingen Date: Fri, 4 May 2018 17:00:01 -0400 Subject: [PATCH] feat: Adding Yield() enumerable extension, that turns an object into a single-item enumerable. --- ICD.Common.Utils/Extensions/EnumerableExtensions.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ICD.Common.Utils/Extensions/EnumerableExtensions.cs b/ICD.Common.Utils/Extensions/EnumerableExtensions.cs index 74e69ba..a6662f4 100644 --- a/ICD.Common.Utils/Extensions/EnumerableExtensions.cs +++ b/ICD.Common.Utils/Extensions/EnumerableExtensions.cs @@ -801,6 +801,18 @@ namespace ICD.Common.Utils.Extensions return output; } + /// + /// Wraps this object instance into an IEnumerable + /// consisting of a single item. + /// + /// Type of the object. + /// The instance that will be wrapped. + /// An IEnumerable<T> consisting of a single item. + public static IEnumerable Yield(this T item) + { + yield return item; + } + /// /// Given a sequence [A, B, C] returns a sequence [[A, B], [B, C]] ///