There are several interesting new features and enhancements in C# 8.0. Indices and ranges are two new additions — available as part of the new System.Index and System.Range types, respectively — that are used for indexing and slicing. This article presents a discussion of how we can work with indices and ranges in C# 8.0.
To work with the code examples provided in this article, you should have Visual Studio 2019 installed in your system. If you don’t already have a copy, you can .
Create a console application project in Visual Studio 2019
First off, let’s create a .NET Core console application project in Visual Studio. Assuming Visual Studio 2019 is installed in your system, follow the steps outlined below to create a new .NET Core console application project in Visual Studio.
- Launch the Visual Studio IDE.
- Click on “Create new project.”
- In the “Create new project” window, select “Console App (.NET Core)” from the list of templates displayed.
- Click Next.
- In the “Configure your new project” window shown next, specify the name and location for the new project.
- Click Create.