Hidden Features of C# That Textbooks Don't Talk About
Hi everyone! I've been writing in C# for about a year, read several books (Schildt, Troelsen), but I feel the language is much deeper than it seems. On StackOverflow I came across the thread "Hidden Features of C#" with 760k views, but it's all in English.
I'm interested specifically in those features that aren't obvious to a beginner. For example, I recently learned about `nameof()` — seems like a small thing, but it helps with refactoring. Or about `??` (null-coalescing) — I used to write long ifs.
But there are things I don't understand at all. For example, what is `yield return`? I've seen it in examples, but I can't grasp why it's needed if you can just return a List. I've also heard about "extension methods" — supposedly you add methods to existing types, but how does that work internally?
And the biggest question: is it true that in C# there is a way to write
No answers yet.
Log in to leave an answer
Blogs