Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:02:45+00:00 2026-05-26T10:02:45+00:00

I almost don’t use yield operator (I don’t hate it :)). I prefer to

  • 0

I almost don’t use “yield” operator (I don’t hate it :)). I prefer to use LINQ if it is possible.
Anyways, I looked for some post (you can find link below) 10 minutes ago, read it and some idea visited my brain 🙂

rewrite-this-foreach-yield-to-a-linq-yield

Idea: Probably, it is not very good that I don’t use “yield”. Probably, it has better performance than LINQ or some other advantage.

Therefore I have next question, what code is more “correct” (yield or LINQ) in example above (in common case)?

P.S. I am interesting for cases when we have possibility to use LINQ instead of “yield”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:02:46+00:00Added an answer on May 26, 2026 at 10:02 am

    I think it’s clearer to use LINQ in that case, personally. It’s operating at a higher level than “call this method, yield this result” – it describes the overall results.

    Iterator blocks are very useful for implementing LINQ though – either the existing operators, or adding your own. It’s worth knowing about them, but I wouldn’t worry about the fact that you’re not using them much – that’s not a sign of poor code or anything like that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Almost everything I've ever read about Java says don't use float or double for
I don't know almost anything about this so if you have some experience let's
1) I don't underestand why the samples of Android almost use AsyncTasks as private
I don't edit CSS very often, and almost every time I need to go
( Almost exact duplicate of Keeping original format POST passing through AWK submitted by
Almost all of the examples in the jQuery tutorials that I've read, usually use
I have a scraper, which queries different websites. Some of them varyingly use Content-Encoding.
Almost every game use keyboard as input. I have been searching for 2 days
I don't understand the purpose of using templates in Kohana. I see almost no
Almost every project that I work will have some sort of tab delimited file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.