mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 00:38:47 +00:00
perf: lazily yield additional value
This prevents an allocation of the array, saving approximately half. Initial benchmarks also show this implementation to be ~100ns faster
This commit is contained in:
parent
14e638e6d9
commit
d56d12ca23
@ -31,7 +31,12 @@ public static class EnumerableExtensions
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return source.Concat(new[] {value});
|
foreach (TSource item in source)
|
||||||
|
{
|
||||||
|
yield return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user