Articles

C# 8.0 will introduce new language feature — default implementations of interface members. This means that we can define a body-to-interface member and implementing class that doesn’t implement the given interface member and will use the default one from interface itself. Here’s my deep-dive and analysis of default implementions of interfaces.

Default Implementations of Interface Members

Let’s start with a classic example based on Mads Torgersen’s blog post, Default implementations in interfaces, and take a look at this famous logger example. Let there be an interface for a logger.

Source de l’article sur DZONE

While messing with dictionaries to create form data for FormUrlEncodedContent to see I could send data to a server using an HTTP client, I started thinking about easier and cleaner ways to do it. I was writing integration tests and I wanted to re-use some model classes instead of dictionaries. Here’s how to do it. Sample integration test is incluced.

Those who are currently writing integration tests for some ASP.NET Core web applications may also find the following writings interesting:

Source de l’article sur DZONE