In my last post, we got familiar with the internals of string switch statement in C#. Today, we are going to deeply understand another language feature – iterators. Iterators in C# Despite the fact that iterators (using yield keyword) were introduced back in C# 2.0, many folks are still confused how they work. Honestly, I’m not surprised at all, because to me this mechanism was a mystery for a long time. Of course, we have to clearly distinguish two things here:How do...
Sztuka programowania 2503 dni, 19 godzin, 35 minut temu 152 źrodło rozwiń
Nowadays, asynchronous programming isn’t something unusual. We all know that when it comes to do some I/O operations or HTTP request, we should do it async. Why? There’re several reasons but two most important are:Efficiency. In many cases, the code might work faster. That’s because it’s not forced to wait for the result. Instead, it can work on some other stuff and then come back for the response when it’s ready. Simple is that.Comfort. Async improves the comfort of using our applications. We don’t blo...
Sztuka programowania 2893 dni, 15 godzin, 3 minuty temu 334 źrodło rozwiń