C# 7.0: Deconstruction demystified

Introduction

Let’s talk about one of the cool new features of C# 7.0 - deconstruction. Quite often you might need to return more than one value from a method, which can be accomplished in several ways:

  • use out/ref arguments (usually considered a code smell)
  • create a more meaningful class/struct that represents the result of calling the method (a preferable option, especially as the number of returned values grows)
  • use System.Tuple (some kind of a middleground)

They all work, but in fact only a special return type feels like a good solution, since both out arguments and explicitly used tuples look just like a boilerplate code and don’t contribute to readable code.

[Read More]

Abusing .NET Core CLI

When developing with .NET Core, you have two different workflows to choose from: manage projects from Visual Studio or work from a command-line using dotnet commands. New projects can be created this way, and after the recent updates the project templates system became extensible, allowing to install additional templates or even create your own.

[Read More]

Static site deployment options

I know that for a lot of people their blog is something that should just work. So they go for WordPress and focus on writing, especially when a blog happens to be a major source of income. Well, mine has zero commercial value and I also enjoy being a web developer, so I keep using the blog as a guinea pig for new ideas.

[Read More]

NDC London: talks

Last three days of NDC London presented a constant paradox of choice, since every hour 7-8 speakers would have parallel sessions in different rooms. How the hell am I supposed to pick only one, if all of them are great? How on earth can you choose between Jon Skeet and Mark Seeman? My way of solving this problem was to spend an hour every evening going through the list of the next day’s speakers and googling their talks from the past. Sometimes this helped me to pick a brilliant talk from someone I had not known yet, sometimes this meant I would go to the Bill Wagner’s talk and… well, more on that later.

Being an old-school geek, I still prefer to make notes on paper, so I have pretty good coverage of what I learned during these talks. Hopefully all the recorded sessions will be available on the web soon (that’s the part I really like about NDC), but before this happens, here’s a list of my observations and learnings from the talks I personally attended.

[Read More]

NDC London: ASP.NET Core workshop

Apparently last year I was a good boy, because Santa has already made several of my dreams come true in 2017. This week I am visiting London and attending NDC London, one of the greatest and most inspiring conferences I am aware of. Until now I only knew it by watching numerous recorded talks from the past and listetning to these top notch developers on .NET Rocks. Well, this morning I was in an elevator with Scott Allen, whose courses on PluralSight were the major part of my learning materials on ASP.NET some years ago. And when I stepped out of this elevator, first thing I heard was “Hi, I’m Richard Campbell” (that’s exactly 50% of .NET Rocks I just met). I know, it sounds silly, but I actually feel like a little boy meeting his all time football idol or somebody like that.

[Read More]

Coffee and Links #4

Happy New Year everyone and thank you for reading this blog!

I decided to slightly modify the format of this series, so that the posts have only 3-5 links, but carefully selected and more focused ones. Information overload isn’t a joke and trying to learn everything is often counterproductive (ask me how I know it), while picking your battles and practicing deep reading helps internalize things you read.

[Read More]

C# 7.0 and Visual Studio 2017 RC

A new Release Candidate of Visual Studio 2017 has been released recently, featuring faster installation and solution loading, an updated project file format, improved IntelliSense, better navigation, and some new built-in refactoring actions covering a significant part of commonly used ReSharper functionality. In this post we will look briefly into these items and will also do a small coding exercise to demonstrate some cool features of C# 7.0.

[Read More]