From e43a7200c68051ee4c82fd3dc0abab14bcfb9caf Mon Sep 17 00:00:00 2001 From: Drew Tingen Date: Fri, 4 May 2018 17:00:01 -0400 Subject: [PATCH 1/2] 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]] /// From 07b89edc661d96c6547efc46e9ecb275fda9fdc7 Mon Sep 17 00:00:00 2001 From: Drew Tingen Date: Fri, 4 May 2018 17:10:38 -0400 Subject: [PATCH 2/2] chore: updating changelog and assembly version --- CHANGELOG.md | 1 + ICD.Common.Utils/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ec3d2..165e567 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] + - Added Yield extension to return a single-item enumerable for an object. ## [3.0.0] - 2018-04-23 ### Added diff --git a/ICD.Common.Utils/Properties/AssemblyInfo.cs b/ICD.Common.Utils/Properties/AssemblyInfo.cs index 2303f51..c76d6ed 100644 --- a/ICD.Common.Utils/Properties/AssemblyInfo.cs +++ b/ICD.Common.Utils/Properties/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System.Reflection; [assembly: AssemblyCompany("ICD Systems")] [assembly: AssemblyProduct("ICD.Common.Utils")] [assembly: AssemblyCopyright("Copyright © ICD Systems 2018")] -[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.1.0.0")]