Implicit Operators – Clean Code Secrets Or Buggy Nightmare?
Implicit operators in C# are a feature that can make our code more readable and expressive. But beware! Misuse can backfire and cause a great deal of headaches!
Implicit operators in C# are a feature that can make our code more readable and expressive. But beware! Misuse can backfire and cause a great deal of headaches!
Let's dive into the plugin architecture design pattern, exploring how it can be leveraged in ASP.NET Core to create more flexible and maintainable applications.
Working with strings is probably one of the earliest things we get to do as C# developers. In fact, if you consider that most of us start with the "Hello, World!" example, you're being exposed to the string type right away. But as you continue to use strings, you'll quickly find that you want to work with strings that span multiple lines and how we define multiline strings might be a tricky topic for beginners. No sweat! In this article, we'll look at some simple code examples that demonstrate how to define multiline strings. I'll also link over to GitHub where you can see this code committed and pushed up to a public repository. Finally, the last example contains a special bonus that I think you'll like (even if it's a slightly more advanced topic). Read until the end! What's…
In C# 9.0 we received access to a great quality of life type called the record. You can read more about that from Microsoft here. Record types allowed us as dotnet programmers to skip a lot of boiler plate code, thereby saving us time and making code more readable. Wins all around! Before record types, we might have simple data transfer objects (called DTOs) that would look something like the following: public sealed class MyData { public MyData( string value1, int value2) { Value1 = value1; Value2 = value2; } publc string Value1 { get; } publc int Value2 { get; } } And for a simple class with two properties... I think we can all agree that the verbosity here is just over the top. With the record type that we were given access to, we can now write…