When to use C# LINQ with Query Syntax over Method Syntax

#247 – February 24, 2019

sponsor

Connect your data with Devart providers - 20% off

Devart offers a wide choice of world-class data connectivity solutions for various data connection technologies and frameworks. Use the promo code ‘CDIGEST19’ and grab your 20% discount on ADO.NET providers with ORM support.

this week's favorite

When to use C# LINQ with Query Syntax over Method Syntax

In LINQ, there are 2 syntax flavors: query-syntax and method-syntax. While Method-Syntax is more popular, it isn’t always better. There are several cases where query syntax is better, and this is what this article is all about. By better, I mean it makes more readable code.

6 types of code you shouldn’t have inside your .NET controllers

“Your .NET controllers should be thin” The ever-repeated platitude with 3 metric tons of baggage to unpack. Why should they be thin? How does that benefit you? What steps can I take to get them thin if they aren’t already? How do I keep them that way?

Multithreading made easy – Parallel ForEach

This week, I was presented with an interesting problem. I had a WPF application which allowed users to scan documents from a commercial scanner into a list of System.Drawing.Image objects, then the images would be searched for barcodes using the great ZXing.Net library.

C# 8: switch statement

At the end of January the .NET Core development team has released a new version of the .NET Core framework, .NET Core 3 preview 2. It delivers a few new C# features to developers. It is nice to see the language improving and I like all of them. But today I would like to talk about only one and it is "switch expressions". What is special about this feature is that it demonstrates the trend in language design.

C# 8 – Introducing Index struct and a brand new usage for the hat operator

We have been talking about C# 8 a lot lately. We have talked about how interpolated verbatim strings are being simplified (here), how default interface methods are being introduced (here) and we have many many more features to discuss about as C# 8 is introducing a lot of new and useful stuff.

projects

Security Newsletter

If you wanna keep on top of infosec news check out Dieter's security newsletter. You will learn about the latest vulnerabilities, breaches, and patches first!

newsletters