I wanted to write this post because I realized that a lot of developers have difficulty writing asynchronous delegates. I often see synchronous delegates in code review that could be transformed. So in this post I will show you how to proceede without however going over the usefulness of asynchronism, this is not the purpose of this post.
The C# compilers have been open source since 2014, now in the dotnet/roslyn repository. The dotnet/csharplang split off to provide a dedicate public space for the innovation and evolution of the C# language. Now, dotnet/csharpstandard completes the group, providing a public space for the ongoing work to document the standard for the latest C# language versions.
.NET 5 (released in November 2020) includes support for C# 9, a major new version of the C# programming language. This series of articles explores the new features in .NET’s main programming language. In this first article, we’ll look at top-level statements and target-typed new and conditional expressions. These features make C# less verbose and can be used in everyday programs.
In this article, we continue to explore string manipulations by focusing on interpolation. Instead of concatenating many pieces together, interpolation allows us to insert special tokens inside a string. A value then replaces those tokens. Interpolation and concatenation play the same role, but often one ends up being more elegant than the other and makes the code easier to maintain.
Do you want to start writing unit tests and you don't know how to start? Were you asked to write some unit tests on a past interview? Let's see what is a unit test and how to write your first unit tests in C#.
In this blog post, let’s look at C# 9.0 pattern matching in switch expressions. In the previous blog post you learned about using patterns with the is pattern expression, and you learned about the new relational patterns in C# 9.0, and also about the new pattern combinators and and or. If you haven’t read the previous blog post, I recommend you to read it, as I don’t repeat the basics of relational patterns and pattern combinators in this blog post.
The C#/WinRT team is excited to announce our latest release, which includes a preview of C#/WinRT authoring with the latest C#/WinRT NuGet package, as well as updates to the .NET 5.0 SDK with the .NET February update. Since our last blog post on C#/WinRT v1.0, we have some new features to show off!
I was working with the Spotify API and reading through the authorization documentation. Like most APIs, we need to securely access the service, authorized as the client application or on behalf of a user. We’ll need to deal with secret tokens and likely encode them into a Base64 string in that process. The client credentials flow requires we concatenate the service provided secrets of clientId and clientSecret, after which we Base64 encode the result.
Generating clients for APIs is a tremendous way to reduce the amount of work you have to do when you’re building a project. Why handwrite that code when it can be auto-generated for you quickly and accurately by a tool like NSwag? To quote the docs
A developer gives a tutorial on how to create a dynamic business rule engine using the C# language, providing all the code you need to follow along.