ijw.Next.IndexRange 1.0.2

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 ijw.Next.IndexRange.

Packages Downloads
Sripe.UniDrilling.Client
Package Description
4
ijw.Next.Collection.Async
Package Description
2
ijw.Next.Reflection
What's New: 0.3.14(2024.12.4): *update dep, fix warning of old packages. 0.3.14(2023.5.27): *ReflectionHelper.LoadAssembly method , use logger 0.3.11(2023.5.26): *ReflectionHelper.LoadAssembly method 0.3.10(2023.4.27): +AssemblyLoader 0.3.9(2023.4.25): +ReflectionHelper.LoadAssembly method 0.3.8(2023.4.16): +net60 net70 support 0.3.(2022.9.19): *update dep 0.3.6(2020.12.1): *Fix bug: FillPropertiesOfBasicType when value is DBNull 0.3.5(2020.9.22): *FirstAttributeOrDefault comments fix. 0.3.4(2020.6.29): *Obj.FillPropertyOfBasicType: do nothing for null value when setting not-nullable property. +PropertyInfo.FirstAttributeOrDefault extension method. 0.3.0(2020.6.18): +Object.FindAttribute method. 0.2.7(2020.6.16): *Fix nullable fill bug in net472 0.2.6(2020.5.1): +Set from JsonElement overload. 0.2.5(2020.4.28): +IEnumerable ToGenericList() method. 0.2.4(2020.4.27): +obj.Set() method overload. 0.2.3(2020.4.26): +obj.Set() method. 0.2.2(2020.1.3): *obj.Get() method, add net35/net40 support. 0.2.1(2019.12.21): *obj.FillPropertiesOfBasicType() method, add enum support. 0.1.7(2019.12.20): +class IgnoreFillingAttribute.
2
ijw.Next.Windows
What's new: 0.3.1 (2024.12.4): *update pkgs. 0.3.0 (2023.7.9): *update pkgs. 0.2.0 (2022.5.18): *add net5.0 and net 6.0 support 0.1.8 (2021.9.14): *Fix bug: AutoStartHelper.UnsetAutoStart, filename adding quote. 0.1.7 (2021.8.17): +LockScreenHelper and wts related apis +Win32 apis from ijw.Next.Windows.Win32 +WinConsole apis from ijw.Next.Windows.WinConsole 0.1.6 (2021.8.13): +AutoStartHelper 0.1.5 (2020.6.19): +netcoreapp3.1 support 0.1.4 (2020.6.9): +AppConfig[settig].set method now is ok for adding new setting. 0.1.2 (2020.1.6): +AppConfig.Refresh() 0.1.1 (2019.12.28): +AppConfig.Refresh() 0.1.0 (not sure): +First release.
2
ijw.Next.DDD
Package Description
2
ijw.Next.AppConfig
What's New: 0.4.7(2024.11.22): *fix bug, config could be null in GetConfig(configName) when deserializing *update ijw.Next.Serialization.Json to fix warning by Json.net 0.4.8(2023.7.11): *fix format; *TypeNameHandling = TypeNameHandling.Auto 0.4.5(2023.7.10): *Fix bug: save to file. *Write json format string. 0.4.4(2023.4.16): +net60 net70 support 0.4.3(2020.9.18): +createDefaultFunc 0.4.0(2020.9.11): *appConfigs autosave Introduction: This package includes the classes for app config that support load/save.
2
ijw.Next.Log.File
What's New: 0.1.4(2024.12.4): +net 60/80 support 0.1.3(2024.11.22): *fix bug: Update system.* pkg to fix warning
1
ijw.Next.Collection.Indexable
Package Description
1
ijw.Next.Net.Http
What's New: 0.1.7(2024.11.20): *update system.net.http => 4.3.4 for net45 0.1.6(2023.4.24): *update pkg 0.1.5(2021.2.18): *update pkg 0.1.3(2021.1.7): *update pkg 0.1.2(2020.3.3): +DownloaderHelper Introduction: This package includes a few classes for download files or htmls from url.
1
ijw.Next.Reflection.CodeGen
What's New: 0.1.2(2022.4.16): +clean code. *Fix bug for loading dynamic assembly 0.1.1(2020.4.30): +clean code. *Fix bug for loading dynamic assembly 0.1.0(2019.12.20): +First release.
1
ijw.Next.IO
What's New: 0.7.0(2024.12.10): +net80 net90 support. *FileInfo.ReadLines => FileInfo.ReadLinesWithLineNumber +new FileInfo.ReadLines 0.6.17(2023.4.16): +net60 net70 support. 0.6.16(2022.9.19): *use ValueTupleBridge as dep for old net runtime 0.6.14(2021.11.26): *upgrade ijw.next dep, in case winform designer crash:( 0.6.13(2021.9.4): *change default encoding for StreamWriterHelper.NewStreamWriterToStream +IEnumerableStringExt class with WriteToFile method 0.6.12(2021.8.3): *FileHelper.CopyFiles, add tryHarderWhenOverwrite. 0.6.11(2021.7.26): *BatchCopyNotFinishedException inherited from IOException. 0.6.10(2021.7.21): *FileHelper.CopyFiles Fix bugs. 0.6.9(2021.7.14): *CreateReadonlyStream bug fixed: add fileAccess. 0.6.8(2021.6.24): *GetFilesIncludeSubFolders for all TargetFrameworks 0.6.7(2021.6.14): *Fileinfo.Extension: when no extension bug 0.6.6(2020.3.23): +GetMD5 and GetSha1 +CheckMD5 and CheckSha1 0.6.3(2020.2.8): *update ijw.next dep 0.6.2(2020.11.20): +GetFilesIncludeSubFolders 0.6.1(2020.11.16): +net50 0.5.0(2020.6.33): +CompressionHelper 0.4.9(2020.6.9): *FileAccess. 0.4.8(2020.3.9): +FileInfo.Rename method. -clean directoryinfo.forAllfile methods. 0.4.6(2020.3.3): +FileExistException. 0.4.4(2020.3.2): +FileInfo.IsVideo and FileInfo.ExtensionName extensions. 0.4.3(2020.3.1): +DirectoryInfo extension. 0.4.2(2019.11.7): *encoding may not applied when create a streamreader. Introduction: This package includes a few classes for processing welllog realtime data.
1
Sripe.UniDrilling.Domain
Package Description
1
ijw.DDD
Package Description
1
ijw.Next.DataAccess
What's New: 0.2.1(2023.4.16): +net60 net70 support. 0.2.0(2019.11.25): -Oracle to ijw.Next.DataAccess.Oracle.Core package. Introduction: This package includes a few classes for access Data source, CRUD etc.
1
ijw.Next.IO.CsvReader
What's New: 0.2.2(2022.4.16): *add net7. 0.2.1(2021.11.6): *add net6. 0.2.0(2019.11.7): *using new ijw.next.io package, update read string code. Introduction: This package includes a few classes for processing welllog realtime data.
1
ijw.Next.DataAccess.Oracle.Core
What's New: 0.1.9(2024.12.4): +net8.0, 9.0 support *update dep, fix warning of packages. 0.1.8(2023.4.16): +net60 net70 support. 0.1.7(2020.12.5): +query scalar list. 0.1.6(2020.12.4): *log text. +cancelToken for all async methods in oracleDbHepler class. 0.1.4(2020.12.1): *update pkgs. 0.1.3(2020.07.02): +logger.writetrace 0.1.2(2019.12.20): +obj.FillPropertiesOfBasicType overload 0.1.1(2019.11.25): +First Release Introduction: This package includes a few classes for access Data source, CRUD etc.
1
ijw.Next.IO.FileSystem.Watcher
Package Description
1
ijw.Next
What's New: 0.7.8(2024.12.23): *fix: delegateHelper.TryRunUntilNotNull func return null possibly. 0.7.7(2024.12.23): +net80 90 support *fix: ConsoleHelper.readKeyInSeconds throws when console window adjusts width. 0.7.6(2023.4.16): +net70 support 0.7.5(2023.1.11): *Add enum value extension classes. 0.7.4(2021.11.6): *Fix warning for net6.0 and net5.0 0.7.3(2021.8.26): *fix bug: ijwHelper.ToAllEnumStrings when collection is empty. *fix bug: stringBuilder.RemoveLast when there are no enough length to remove. 0.7.2(2021.2.9): *fix bug: throws CollectionEmptyException in IEnumerableContractShouldExt.ShouldNotBeEmpty(); 0.7.1(2021.2.7): +CollectionEmptyException *throws CollectionEmptyException in IEnumerableContractShouldExt.ShouldNotBeEmpty(); 0.7.0(2020.11.16): +net50. 0.6.12(2020.10.27): +ProcessHelper. 0.6.8(2020.10.19): *ToAllEnumString() +ProcessHelper. 0.6.5(2020.9.11): +Obj.HasProperty() extension. 0.6.4(2020.9.11): 0.6.3(2020.9.9): +enum extensions 0.6.1(2020.9.8): *should contract, add Exception message. +enumitems classes 0.5.8(2020.6.12): +interface IDebugString. +Object.ToDebugString extension method. +DataIndexAttribute and DebugStringDisplayNameAttribute 0.5.7(2020.6.4): +String.SubstringAfter and SubstringBefore extension methods. +String.SubstringBetween extension method. 0.5.4(2020.3.8): +Long.ToChineseNumberString extension method. +String.ParseChineseNumberToInt extension method. +String.FindAllChineseNumberStrings extension method. 0.5.3(2020.3.2): +Object in { } extension methods 0.5.2(2020.1.6): +obj.toBoolean toBooleanAnyway toBooleanNullable methods 0.5.1(2019.12.20): *obj.toOtherType, obj could be null 0.4.9(2019.12.17): -object.ToStringAnyway()/ToStringNullable() methods. 0.4.8(2019.11.25): -object.ToOtherType() methods. 0.4.7(2019.11.25): +ObjectToBasicType extension methods. 0.4.2(2019.11.7): +byte[].ToHexString. 0.4.1(2019.11.7): *string.shouldExistSuchFile() and string.ShouldBeValidAbsoluteName() return fileinfo now. Introduction: This package includes a few classes for processing welllog realtime data.
1
ijw.Next.Net.Utils
What's New: 0.1.9(2024.11.20): *fix bug: update chinaz html ip parsing *update ijw.next.net.http => 0.1.7 0.1.7(2022.4.24): *update pkgs 0.1.6(2021.1.7): *update pkgs 0.1.5(2020.5.28): *GetExternalIPByIpIp, ipip.net website has changed its content, fix and match the changes. *fix bug: throw exception when ip invalid. 0.1.3(2020.4.17): *GetExternalIPByIpIp, ipip.net website has changed its content, fix and match the changes. Introduction: This package includes a few net tool classes.
1
ijw.Next.Html
Package Description
0

* Mark assembly as CLS compliant.

.NET Framework 3.5

.NET Framework 4.5

.NET Framework 4.7

  • No dependencies.

.NET Standard 1.4

.NET Standard 2.0

  • No dependencies.

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
1.0.2 1 2025/4/17