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 |
|---|---|
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
- Bot API 9.1 (https://core.telegram.org/bots/api#july-3-2025)
- ReplyParameters(Message) supports null
- Fix MessageLink() for non-topics group
- TransferGift: fix type for newOwnerChatId
- Sealed some internal types for performance
- faster IsServiceMessage
|
7 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
New helper method SendHtml (supports <img> <video> <file> <keyboard> tags)
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Fix SendHtml with switch_inline=
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Also generating " in msg.ToHtml()
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Added undocumented fields Chat.IsDirectMessages & ChatFullInfo.ParentChat
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Implicit conversion from List<> and List<List<>> to reply markup
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Polling: Clarify methods descriptions.
Removed IUpdateReceiver/DefaultUpdateReceiver (loop code moved directly into Polling)
Obsoleted AsyncEnumerableReceivers
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
- Bot API 10.3 https://core.telegram.org/bots/api#august-24-2026
- Support unsupported rich block/text (fixes #1487)
- SendHtml supports ephemeralMessageParameters
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
SendHtml/ToHtml now use tg-spoiler for media spoiler, compatible with Rich Html)
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
ToRichHtml: fix <tg-map>
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Added ChatAdministratorRights(bool) constructor
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
SendHtml now supports <preview> control, and sending media from streams (stream://N)
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Sealed some internal types for performance
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Bot API 9.0b (CanDeleteSentMessages)
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
override ToString for InputFile* classes => (Id, Url, "stream://..")
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
fix type (int -> long) for TopicId and StarCount fields
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Bot API 9.5
https://core.telegram.org/bots/api-changelog#march-1-2026
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Add ApiResponse to JsonBotSerializerContext (#1478)
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Implicit construction of ChatId from User
|
1 |
|
Telegram.Bot
This library gives you easy access to Telegram Bot API so you can start building useful bots for Telegram.
Release Notes:
Added ChatMember.ExpireDate helper (= generic UntilDate)
|
1 |
- Add support for .NET Framework 3.5.
- Produce a deterministic build.
- Embed symbols in the NuGet package.
.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.