Merge branch 'EnumerableYield' of Common/Utils into dev

This commit is contained in:
Chris Cameron
2018-05-04 21:12:57 +00:00
committed by Gogs
3 changed files with 14 additions and 1 deletions

View File

@@ -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

View File

@@ -818,6 +818,18 @@ namespace ICD.Common.Utils.Extensions
return output;
}
/// <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&lt;T&gt; consisting of a single item. </returns>
public static IEnumerable<T> Yield<T>(this T item)
{
yield return item;
}
/// <summary>
/// Given a sequence [A, B, C] returns a sequence [[A, B], [B, C]]
/// </summary>

View File

@@ -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")]