IndexRange 1.0.1
This package lets you use the C# 8.0 index and range features in projects that target .NET Framework or netstandard2.0.
Using Range with Arrays
The C# compiler needs the RuntimeHelpers.GetSubArray<T> method to be available to create subranges from arrays. This method is only available in netstandard2.1 and .NET Core 3.0, so creating subranges from arrays will fail to compile in .NET Framework.
Use Span<T>
A workaround is to add a reference to System.Memory and use Span<T>. Not only does this compile, it's much more efficient as it doesn't create a new array and copy the sliced data to it:
int[] array = new[] { 1, 2, 3, 4, 5, 6 };
// don't do this:
// var slice = array[1..^1];
// do this:
var slice = array.AsSpan()[1..^1];
Define GetSubArray<T>
The other fix is to define the necessary method in your source code. Copy the following code into your project:
https://gist.github.com/bgrainger/fb2c18659c2cdfce494c82a8c4803360
That type is not in this NuGet package so that the C# compiler doesn't warn that The predefined type 'RuntimeHelpers' is defined in multiple assemblies.
Showing the top 20 packages that depend on IndexRange.
| Packages | Downloads |
|---|---|
|
Apache.IoTDB
C# client of Apache IoTDB.
Apache IoTDB (Internet of Things Database) is a data management system for time series data, which can provide users specific services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field.
|
7 |
|
Apache.IoTDB
C# client of Apache IoTDB.
Apache IoTDB (Internet of Things Database) is a data management system for time series data, which can provide users specific services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field.
|
4 |
|
Semver
A semantic version library fully compliant with v2.0.0 of the spec found at http://semver.org.
|
3 |
|
Semver
A SemVer implementation in .Net based on v2.0.0 of the spec found at http://semver.org
|
3 |
|
Apache.IoTDB
C# client for Apache IoTDB
|
2 |
|
Apache.IoTDB
C# client of Apache IoTDB.
Apache IoTDB (Internet of Things Database) is a data management system for time series data, which can provide users specific services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field.
|
2 |
|
Semver
A semantic version library fully compliant with v2.0.0 of the spec found at http://semver.org.
|
2 |
|
NewLife.Core
核心基础组件,日志(文件/网络)、配置(XML/Json/Http)、缓存(内存/Redis)、网络(Tcp/Udp/Http)、RPC框架、序列化(Binary/XML/Json)、APM性能追踪。旧版请找2021.1225
|
1 |
|
Semver
A SemVer implementation in .Net based on v2.0.0 of the spec found at http://semver.org
|
1 |
|
Apache.IoTDB
C# client of Apache IoTDB.
Apache IoTDB (Internet of Things Database) is a data management system for time series data, which can provide users specific services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field.
|
1 |
|
Apache.IoTDB
C# client for Apache IoTDB
|
1 |
.NET Framework 3.5
- ValueTupleBridge (>= 0.1.5)
.NET Framework 4.5
- System.ValueTuple (>= 4.5.0)
.NET Framework 4.7
- No dependencies.
.NET Standard 2.0
- No dependencies.
.NET Standard 2.1
- No dependencies.