Visual Studio Tips and tricks: Open the documentation of a symbol

  • Tips
When you write code, you sometimes need to read the documentation of a method or a class to understand how it works. The IntelliSense already provides useful information, but the documentation can contains useful remarks or links that you may need. You can open your favorite search engine and search for the name of the method. If you are lucky the first result is the link to the Microsoft documentation.…[read more]

How to use C# 8 Indices and Ranges in .NET Standard 2.0 and .NET Framework

  • .NET
Index and Range are 2 new types that support the new language features: hat and range operators. The ^ operator indicates the element position from the end of a sequence. For a sequence of length length, ^n points to the element with offset length - n from the start of a sequence. For example, ^1 points to the last element of a sequence and ^length points to the first element of a sequence. The ..…[read more]

Visual Studio Tips and tricks: Default startup project

  • Tips
When you first open a solution, you just want to press F5 to start debugging. If the solution contains multiple projects, you want the main project to be the startup project. You don't want the library project to be the startup project, but the web or desktop application. This provides a good development experience. Of course you can change the startup project manually using the context menu or the…[read more]

How to use Nullable Reference Types in .NET Standard 2.0 and .NET Framework

  • .NET
In the previous post, I've explained how to use Nullable Reference Types and why this is a good feature. However this feature works well only with .NET Core 3.0. Note that C# 8.0 is not meant for older targets, such as .NET Core 2.x or .NET Framework 4.x. So some additional language features may not work unless you are targeting .NET Core 3.0 or .NET Standard 2.1 It doesn't mean you cannot use it with…[read more]

Visual Studio Tips and tricks: Find the current opened file in the solution explorer

  • Tips
In Visual Studio you can easily open a file using the search everything functionality (Ctrl+T). But for some operation, such as renaming a file, you need to find the file in the solution explorer. You can quickly locate the currently opened file in it using Ctrl+[, S or using the following button: You can also activate the option "Track Active Item in Solution Explorer" to automatically select the current…[read more]