© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Best way to Convert a single element to IEnumerable element - C#
C
C#
•
4y ago
•
8 replies
Gladiator
Best way to Convert a single element to IEnumerable element
What is the best way
(performance
, memory
, GC
) to Convert a single element to IEnumerable
<Element
> elements
?
T
=
> IEnumerable
<T
>
return new []{element};
yield return element;
return new []{element};
yield return element;
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
62,470
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Clean way of adding elements to IEnumerable
C
C# / help
4y ago
❔ Best way to convert rgb to ConsoleColor?
C
C# / help
3y ago
XMl: How to convert IEnumerable<XmlNode> to XmlNodeList ?
C
C# / help
3y ago
❔ IEnumerable to ObservableCollection
C
C# / help
3y ago