Microsoft.Bcl.Memory
9.0.1
Prefix Reserved
dotnet add package Microsoft.Bcl.Memory --version 9.0.1
NuGet\Install-Package Microsoft.Bcl.Memory -Version 9.0.1
<PackageReference Include="Microsoft.Bcl.Memory" Version="9.0.1" />
paket add Microsoft.Bcl.Memory --version 9.0.1
#r "nuget: Microsoft.Bcl.Memory, 9.0.1"
// Install Microsoft.Bcl.Memory as a Cake Addin #addin nuget:?package=Microsoft.Bcl.Memory&version=9.0.1 // Install Microsoft.Bcl.Memory as a Cake Tool #tool nuget:?package=Microsoft.Bcl.Memory&version=9.0.1
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 .NET Framework and .NET Standard.
This library is not necessary nor recommended when targeting versions of .NET that include the relevant support.
Key Features
- Enables the use of
Index
andRange
types on older .NET platforms. - Provides
Base64Url
encoding, decoding, and validation for URL-safe data processing on older .NET platforms.
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
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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
.NETStandard 2.1
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (19)
Showing the top 5 NuGet packages that depend on Microsoft.Bcl.Memory:
Package | Downloads |
---|---|
Fido2.Models
FIDO2 .NET library (WebAuthn) |
|
Microsoft.ML.Tokenizers
Microsoft.ML.Tokenizers contains the implmentation of the tokenization used in the NLP transforms. |
|
Microsoft.ML.TorchSharp
Microsoft.ML.TorchSharp contains ML.NET integration of TorchSharp. |
|
Carbon.Jose
A Javascript Object Signing and Encryption library |
|
RedisCore
.NET lightweight Redis client |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Microsoft.Bcl.Memory:
Repository | Stars |
---|---|
dotnet/machinelearning
ML.NET is an open source and cross-platform machine learning framework for .NET.
|
|
passwordless-lib/fido2-net-lib
FIDO2 .NET library for FIDO2 / WebAuthn Attestation and Assertion using .NET
|
|
Azure/azure-functions-dotnet-worker
Azure Functions out-of-process .NET language worker
|
Version | Downloads | Last updated |
---|---|---|
9.0.1 | 1 | 1/14/2025 |
9.0.0 | 26,215 | 11/12/2024 |
9.0.0-rc.2.24473.5 | 1,257 | 10/8/2024 |
9.0.0-rc.1.24431.7 | 4,431 | 9/10/2024 |
9.0.0-preview.7.24405.7 | 539 | 8/13/2024 |