The annotation for nullable reference types should only be used in code within a ‘#nullable’ context

For anyone ending up here. You can put #nullable enable on top of the file for a file-by-file approach as suggested by @Marc in the comments. You can also use combinations of #nullable enable/disable to annotate just parts of the file class Program { static void Main(string[] args) { #nullable enable string? message = “Hello … Read more

What is the difference between using and await using? And how can I decide which one to use?

Classic sync using Classic using calls the Dispose() method of an object implementing the IDisposable interface. using var disposable = new Disposable(); // Do Something… Is equivalent to IDisposable disposable = new Disposable(); try { // Do Something… } finally { disposable.Dispose(); } New async await using The new await using calls and await the … Read more

What does null! statement mean?

The key to understanding what null! means is understanding the ! operator. You may have used it before as the “not” operator. However, since C# 8.0 and its new “nullable-reference-types” feature, the operator got a second meaning. It can be used on a type to control Nullability, it is then called the “Null Forgiving Operator” … Read more

Why doesn’t the new hat-operator index from the C# 8 array-slicing feature start at 0?

Official answer Here is a comment from Mads Torgersen explaining this design decision from the C# 8 blog post: We decided to follow Python when it comes to the from-beginning and from-end arithmetic. 0 designates the first element (as always), and ^0 the “length’th” element, i.e. the one right off the end. That way you get a simple relationship, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)