Dictionary Initializers in C# 6.0
Dictionary initialization was first introduced with C# 3.0 and the syntax for the same remained same since then.
In C# 6.0 the syntax was tweaked little bit to make it more friendly to maintain. As we all know in a dictionary object, information is stored as key value pairs and if you look at the above syntax a lot of curly brackets and punctuation marks are used. This makes it pretty ugly and doesn’t reflect the data structure which is holding the data.
The new syntax reduces the number of keystrokes and the code is now more elegant and readable by omitting some curly braces and the syntax now uses the equals sign which helps you to recognize the info in a key value pair format
Even though they have introduced a new way on initializing dictionary objects, the old way of writing is still valid and it’s up to you developers to use which one.
No Comments
Connecting Azure Blob Storage account using Managed Identity
Posted 12/9/2022Securing Azure KeyVault connections using Managed Identity
Posted 11/26/2022Manage application settings with Azure KeyVault
Posted 11/9/2022Adding Serilog to Azure Functions created using .NET 5
Posted 4/3/2021Learn how to split log data into different tables using Serilog in ASP.NET Core
Posted 4/23/2020