Skip to content

TimothyMeadows/PinnedMemory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PinnedMemory

License: MIT nuget

PinnedMemory is a cross platform method for creating, and accessing pinned, and locked memory for Windows, Mac, and Linux operating systems in .NET Core.

Install

From a command prompt

dotnet add package PinnedMemory
Install-Package PinnedMemory

You can also search for package via your nuget ui / website:

https://www.nuget.org/packages/PinnedMemory/

Examples

You can find more examples in the github examples project.

using (var pin = new PinnedMemory<byte>(new byte[3]))
{
  pin[0] = 65;
  pin[1] = 61;
  pin[2] = 77;
}
using (var pin = new PinnedMemory<byte>(new byte[3]))
{
  pin.Write(0, 65);
  pin.Write(0, 61);
  pin.Write(0, 77);
}
using (var pin = new PinnedMemory<byte>(new byte[] {65, 61, 77}, false))
{
  var byte1 = pin[0];
  var byte2 = pin[1];
  var byte3 = pin[2];
}
using (var pin = new PinnedMemory<byte>(new byte[] {65, 61, 77}, false))
{
  var byte1 = pin.Read(0);
  var byte2 = pin.Read(1);
  var byte3 = pin.Read(2);
}

About

PinnedMemory is a cross platform method for creating, and accessing pinned, and locked memory in .NET Core.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages