Syntax

All articles categorised as Syntax.

Variable declaration can be inlined – C#

It’s almost two years since I published the post on the Visual Studio IDE information message: “delegate invocation can be simplified.”It is now the second most visited article on my blog!While reviewing some error messages in a new MVC project, I recently learnt something equally as simple and eye-opening. This time, the suggestion is:IDE0018 Variable declaration can be inlinedAs a software developer, you’ll likely recognise the following pattern to declare and initialise a variable:int…

Software Development Read more


Delegate invocation can be simplified – C#

When you have worked with the same technology day-in, day-out for almost 15 years, it’s easy to miss some of the “under-the-radar” changes that are made without any fan-fare. This, for me, is one of those in C#.I couldn’t tell you how many times a day I write code similar to the following, which is a staple of object-oriented, event-driven programming – used to fire an event if something is listening to…

Software Development Read more