mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-10 02:05:20 +00:00
feat: Adding Yield() enumerable extension, that turns an object into a single-item enumerable.
This commit is contained in:
@@ -801,6 +801,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>
|
||||
|
||||
Reference in New Issue
Block a user