January 4

Quiz: How Ranges in C# 8 work

Ranges in C# 8 is a nice new feature that allows slicing collections using a very simple syntax.

This quiz made of a single line of C# 8 can help you understand how Ranges in C# 8 work.

What does this program print to the console? Why?

Post your answer in the comments section below and share the quiz with you friends and colleagues.

How Ranges work in C# 8

In addition, if you want to learn more about Ranges and Indexes check out the Ranges proposal on the official Github project.

To run and play with Ranges you need to install Visual Studio 2019 Preview, .NET Core 3.0 SDK and enable C# 8 by setting the LangVersion tag to 8.0 in your csproj file.

Happy C# coding 🙂


You may also like

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Subscribe to our newsletter now!

    Get instant access to the Master C# 9 webinar to learn all the new exciting C# 9 features quickly.
    Get regular videos and news on C# and .NET and offers on products and services to master C#.

    We will collect, use and protect your data in accordance with our Privacy Policy.