Microsoft.Bcl.Memory 11.0.0-rc.3.26522.148

About

Provides Index and Range types to simplify slicing operations on collections for .NET Framework and .NET Standard 2.0. Provides Base64Url for encoding data in a URL-safe manner on older .NET platforms. Provides Utf8 for converting chunked data between UTF-8 and UTF-16 encodings on .NET Framework and .NET Standard 2.0.

This library is not necessary nor recommended when targeting versions of .NET that include the relevant support.

Key Features

  • Enables the use of Index and Range types on .NET Framework and .NET Standard 2.0.
  • Provides Base64Url encoding, decoding, and validation for URL-safe data processing on older .NET platforms.
  • Provides Utf8 encoding, decoding, and validation for chunked data between UTF-8 and UTF-16 on .NET Framework and .NET Standard 2.0.

How to Use

The Index and Range types simplify working with slices of arrays, strings, or other collections.

string[] words = ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"];

// Use Index to reference the last element
Console.WriteLine(words[^1]);
// Output: "dog"

// Use Range to reference a slice
string[] phrase = words[1..4];
Console.WriteLine(string.Join(" ", phrase));
// Output: "quick brown fox"

Base64Url encoding is a URL-safe version of Base64, commonly used in web applications, such as JWT tokens.

using System.Buffers.Text;
using System.Text;

// Original data
byte[] data = Encoding.UTF8.GetBytes("Hello World!");

Span<byte> encoded = new byte[Base64Url.GetEncodedLength(data.Length)];
Base64Url.EncodeToUtf8(data, encoded, out int _, out int bytesWritten);

string encodedString = Base64Url.EncodeToString(data);  
Console.WriteLine($"Encoded: {encodedString}");
// Encoded: SGVsbG8gV29ybGQh

Span<byte> decoded = new byte[data.Length];
Base64Url.DecodeFromUtf8(encoded[..bytesWritten], decoded, out _, out bytesWritten);

string decodedString = Encoding.UTF8.GetString(decoded[..bytesWritten]);
Console.WriteLine($"Decoded: {decodedString}");
// Decoded: Hello World!

Main Types

The main types provided by this library are:

  • System.Index
  • System.Range
  • System.Buffers.Text.Base64Url
  • System.Text.Unicode.Utf8

Additional Documentation

API documentation

Feedback & Contributing

Microsoft.Bcl.Memory is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.Bcl.Memory.

Packages Downloads
Microsoft.IdentityModel.Tokens
Includes types that provide support for SecurityTokens, Cryptographic operations: Signing, Verifying Signatures, Encryption.
61
Microsoft.IdentityModel.Tokens
Includes types that provide support for SecurityTokens, Cryptographic operations: Signing, Verifying Signatures, Encryption.
60
Microsoft.Extensions.ServiceDiscovery
Provides extensions to HttpClient that enable service discovery based on configuration.
59
NATS.Client.Core
NATS core client for .NET
59
System.Linq.AsyncEnumerable
System.Linq.AsyncEnumerable
58
Microsoft.Extensions.ServiceDiscovery
Provides extensions to HttpClient that enable service discovery based on configuration.
58
NATS.Client.Core
NATS core client for .NET
58
Duende.IdentityModel
OpenID Connect & OAuth 2.0 client library
56
Microsoft.IdentityModel.Tokens
Includes types that provide support for SecurityTokens, Cryptographic operations: Signing, Verifying Signatures, Encryption.
55
System.Linq.AsyncEnumerable
System.Linq.AsyncEnumerable
55
NATS.Client.Core
NATS core client for .NET
55
NATS.Client.Core
NATS core client for .NET
54
IndexRange
Implementations of System.Index and System.Range for netstandard2.0 and .NET Framework.
53
ModelContextProtocol.Core
Core .NET SDK for the Model Context Protocol (MCP)
53
Microsoft.IdentityModel.Tokens
Includes types that provide support for SecurityTokens, Cryptographic operations: Signing, Verifying Signatures, Encryption.
52
System.Linq.AsyncEnumerable
System.Linq.AsyncEnumerable
51
Microsoft.Extensions.ServiceDiscovery.Abstractions
Provides abstractions for service discovery. Interfaces defined in this package are implemented in Microsoft.Extensions.ServiceDiscovery and other service discovery packages.
50
System.Linq.AsyncEnumerable
System.Linq.AsyncEnumerable
50

.NET 10.0

  • No dependencies.

.NET 11.0

  • No dependencies.

.NET Framework 4.6.2

.NET Standard 2.0

.NET Standard 2.1

Version Downloads Last updated
11.0.0-rc.3.26522.148 7 10/25/2026
11.0.0-rc.2.26504.105 10 10/15/2026
11.0.0-rc.1.26425.128 23 09/10/2026
11.0.0-preview.7.26381.103 17 08/13/2026
11.0.0-preview.6.26359.118 24 07/20/2026
11.0.0-preview.5.26302.115 21 06/16/2026
11.0.0-preview.4.26230.115 41 05/14/2026
11.0.0-preview.3.26207.106 45 04/18/2026
11.0.0-preview.2.26159.112 57 03/11/2026
11.0.0-preview.1.26104.118 39 02/15/2026
10.0.14 7 10/25/2026
10.0.13 12 10/14/2026
10.0.12 20 09/10/2026
10.0.11 23 08/13/2026
10.0.10 22 07/20/2026
10.0.9 28 06/14/2026
10.0.8 33 05/15/2026
10.0.7 38 04/23/2026
10.0.6 46 04/18/2026
10.0.5 39 03/14/2026
10.0.4 52 03/11/2026
10.0.3 45 02/12/2026
10.0.2 48 01/16/2026
10.0.1 59 12/11/2025
10.0.0 50 12/11/2025
10.0.0-rc.2.25502.107 43 12/20/2025
10.0.0-rc.1.25451.107 38 12/14/2025
10.0.0-preview.7.25380.108 39 01/03/2026
10.0.0-preview.6.25358.103 49 12/18/2025
10.0.0-preview.5.25277.114 32 01/06/2026
10.0.0-preview.4.25258.110 43 12/20/2025
10.0.0-preview.3.25171.5 38 12/21/2025
10.0.0-preview.2.25163.2 47 12/18/2025
10.0.0-preview.1.25080.5 50 12/11/2025
9.0.22 6 10/25/2026
9.0.21 11 10/14/2026
9.0.20 18 09/10/2026
9.0.19 23 08/13/2026
9.0.18 28 07/19/2026
9.0.17 25 06/16/2026
9.0.16 41 05/15/2026
9.0.15 47 04/18/2026
9.0.14 49 03/11/2026
9.0.13 38 02/12/2026
9.0.12 37 01/16/2026
9.0.11 37 12/23/2025
9.0.10 33 12/21/2025
9.0.9 45 12/23/2025
9.0.8 42 12/11/2025
9.0.7 34 12/27/2025
9.0.6 52 12/13/2025
9.0.5 50 12/11/2025
9.0.4 49 12/11/2025
9.0.3 45 01/04/2026
9.0.2 58 12/13/2025
9.0.1 40 12/16/2025
9.0.0 42 12/18/2025
9.0.0-rc.2.24473.5 54 12/22/2025
9.0.0-rc.1.24431.7 32 12/14/2025
9.0.0-preview.7.24405.7 46 12/12/2025