mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-10 18:24:53 +00:00
Merge branch 'EnumerableYield' of Common/Utils into dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<T> 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>
|
||||
|
||||
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user