© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
14 replies
Thinker

Lambda or extension method reference [Answered]

If you have an extension which maps a type A to another type B and you have an enumerable of type A which you want to turn into an enumerable of type B, should you prefer
.Select(x => x.ToB())
.Select(x => x.ToB())
or
.Select(Extensions.ToB)
.Select(Extensions.ToB)
? The first I assume allocates an extra unnecessary lambda which the second doesn't?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

method reference/callback
C#CC# / help
3y ago
Convert code to utility or extension method
C#CC# / help
4y ago
❔ Class method construction using lambda?
C#CC# / help
3y ago
EF-Core data reference [Answered]
C#CC# / help
4y ago