This package polyfills the types required for the C# 8.0 feature Ranges on targets lower than netcoreapp3.0
and netstandard2.1
. This includes:
net461
Add this to your csproj
file:
<PackageReference Include="Contrib.Bcl.Ranges" Version="1.0.0-preview8.19405.3" />
and add this to the PropertyGroup
:
<LangVersion>8.0</LangVersion>
Now we can start using this handy new language feature
Console.WriteLine("Hello world!"[6..^1]); // world