Here are some of the best .NET, C# and ASP.NET posts from this week.
Here's another LINQ gem, which is very useful if you plan to base your projection or filtering logic on the element's index in a sequence. From the MSDN page for Enumerable.Select(): Projects each element of a sequence into a new form by incorporating the element's index. What the "incorporating the element's index" part means is that you get an extra parameter inside of the Select method's selector, which gets incremented with each processed element. As is common in C#, the index is zero-based.
By Jan Doubek
The web development community has come a long way since the early days of the web. Building interactive web experiences can leave many developers in a state of paralysis. What web framework should we use? What transpiler should create my assets? Do I go with React or VueJS? So many questions that we need to answer. For folks who work on the back end of the technological stack, or for people who only focus on HTML and CSS, rejoice! In this post, we’ll be exploring Turbolinks. An approach to building client-side experiences with little to no client-side code.
By Khalid Abuhakmeh
This blog post continues the series which is a guide through the code analyzers available on the market and their possibilities. I’m trying to help you answer the question: “Which analyzer package should I use and how to configure it to avoid problems related to async/await?". In the previous episode, I presented the first seven most common code smells related to asynchronous programming. Today, I present the next seven traps from this area. Lucky you, they can be easily avoided with an appropriate analyzer - for every issue, I provide entries for .editorconfig that configure analyzers that can detect it. Links to NuGet packages, as well as a complete list of analyzers’ rules, can be found in the previous article.
By Cezary Piątek
gRPC is a modern open source remote procedure call framework. There are many exciting features in gRPC: real-time streaming, end-to-end code generation, and great cross-platform support to name a few. The most exciting to me, and consistently mentioned by developers who are interested in gRPC, is performance. Last year Microsoft contributed a new implementation of gRPC for .NET to the CNCF. Built on top of Kestrel and HttpClient, gRPC for .NET makes gRPC a first-class member of the .NET ecosystem. In our first gRPC for .NET release, we focused on gRPC’s core features, compatibility, and stability. In .NET 5, we made gRPC really fast.
By James Newton-King
When using a generic method, the generic argument (often referred to as
T) must be provided as a known type at compile time. However, sometimes you may have a scenario where you must call a generic method using a type that it not known until run time. This can be problematic and usually results in using a large number of if/else statements. This code can become quite difficult to maintain as you will have to create an if statement for every object type. What would be better is if you could provide the type at runtime by dynamically invoking a generic method while providing the type.
By Brian Lagunas
I post mostly about full stack .NET and Vue web development. To make sure that you don't miss out on any posts, please follow this blog and subscribe to my newsletter. If you found this post helpful, please like it and share it. You can also find me on Twitter.