Tag: csharp
72 posts · Page 4 of 8
2023-10-28 csharpdotnet
C# – ref readonly parameters
The ref readonly modifier in C# provides a more transparent way of passing read-only references. Learn how it improves on the in modifier with better constraints and caller visibility.
2023-10-26 csharpdotnetdotnet-8
C# – How to shuffle an array?
The easiest way to shuffle an array in C# is using Random.Shuffle, introduced in .NET 8. It works in-place on both arrays and spans.
2023-10-20 csharp
C# – What is a NullReferenceException, and how to fix it?
Learn what causes a NullReferenceException in C#, how to debug it, and how to prevent it using null checks, the null-conditional operator, and nullable reference types.
2023-10-19 csharpdotnetdotnet-8
Add/Remove TypeInfoResolver to existing JsonSerializerOptions
Learn how to add or remove TypeInfoResolver instances on existing JsonSerializerOptions using the new TypeInfoResolverChain property in .NET 8.
2023-10-12 csharpdotnet
C# 12 – Interceptors
Learn about C# 12 interceptors, an experimental .NET 8 compiler feature that lets you replace method calls at compile time using the InterceptsLocation attribute.
2023-09-28 csharpdotnet
Implementation type Data.AppDbContext can’t be converted to service type Microsoft.AspNetCore.Identity.IUserStore
Fix the ASP.NET Core Identity error where AppDbContext can't be converted to IUserStore by adding AddEntityFrameworkStores to your identity configuration.
2023-09-25 csharpdotnetdotnet-8
.NET 8 – Serializing properties from interface hierarchies
.NET 8 adds support for serializing properties from interface hierarchies, including all properties from all interfaces depending on the declared variable type.
2023-09-21 csharpdotnetdotnet-8
.NET 8 – Deserialize into non-public properties
Learn how to deserialize JSON into non-public properties in .NET 8 using the JsonInclude attribute and parameterized constructors.
2023-09-17 csharpdotnetdotnet-8
.NET 8 – How to use JsonStringEnumConverter with native AOT
Learn how to use the new JsonStringEnumConverter<TEnum> in .NET 8 for native AOT-compatible enum serialization with System.Text.Json.
2023-09-14 csharpdotnetdotnet-8
The type or namespace name InterceptsLocationAttribute could not be found
How to fix error CS0246 for InterceptsLocationAttribute in C# interceptors by defining the attribute yourself.