////// Takes an object af any type, and returns a list of that type with the object as it's first item. /// public static IEnumerableToEnumerable (this T firstItem) => firstItem == null ? new List (0) : new List (1) { firstItem };
09 July 2018
Extension - Create an enumerable from an object
The following is a simple little extension that takes an object, and returns an IEnumerable with that object as it's first and only element. I originally wrote it for a project called Cloud-X, and put it here as I included it in Project Hermes:
Labels:
.NET,
C#,
Extensions
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment