BitwiseStor 1.0.1
dotnet add package BitwiseStor --version 1.0.1
NuGet\Install-Package BitwiseStor -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BitwiseStor" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BitwiseStor" Version="1.0.1" />
<PackageReference Include="BitwiseStor" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BitwiseStor --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BitwiseStor, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=BitwiseStor&version=1.0.1
#tool nuget:?package=BitwiseStor&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
bitwise-stor-dot-net
A dot.net
-based library for managing/storing up to 31 Boolean switches within an integer value. This is a port to .NET Core from the JavaScript (NPM) version of this same library, bitwise-stor
NPM Package.
Install
Using the .NET Core
CLI
$ dotnet add package BitwiseStor
Usage
Simple cases:
Pack()
& Unpack()
with primitive value manipulation:
using BitwiseStorN;
// intialize bitwise packager
var bws = new Operations();
// get integer value from boolean string
int val = bws.pack('101'); // val = 5
// get a binary digit string (right-most-significant) from an integer
string bits = bws.unpack(val); // bits = "101"
Array cases:
PackArrayOf<T>()
& UnpackArrayOf<T>()
with, you guessed it, Array
types
using BitwiseStorN;
var bws = new Operations();
// get integer value from array of bits string
var val = bws.PackArrayOf<int>(new int[] {1, 0, 1}); // val = 5
// get integer value from array of bool values
var val2 = bws.PackArrayOf<bool>(new bool[] {true, false, true}); // val = 5
// get a binary digit string (right-most-significant) from an integer
var bits = bws.UnpackArrayOf<int>(val); // bits = [1, 0, 1]
var bits = bws.unpackArrayOf<bool>(val); // bits = [true, false, true]
Not Implemented yet...
Object cases:
Pack()
& Unpack()
from a JSON object. The following requirements apply:
- only boolean properties get packed
- packing is shallow (no deep navigation of the object)
- only up to 31 values are packed
- the names of any packed properties are 64-bit encoded under the
BwsPackedPropNames
key - the integer value of the packed bits is stored under the
BwsPackedValue
key - the first boolean key is the most significant bit when packed
Example (using JS):
const bws = require("@aevnpm/bitwise-stor");
const jsonObj = {
name: 'Billy Russo',
hasScars: true,
canFeelLove: false,
age: 38,
cashOnHand: 4500,
isHospitalized: false,
isDeceased: false,
heightInMeeters: 1.9,
hasBankAccount: true
}
const packedObject = bws.packJson(jsonObj);
console.log({ packedObject })
// Console:
// packedObject: {
// name: 'Billy Russo',
// age: 38,
// cashOnHand: 4500,
// heightInMeeters: 1.9,
// bwsPackedPropNames: { ... 64-bit encoding ...},
// bwsPackedValue: 17
// }
const unpackedObject = bws.unpackJson(packedObj);
console.log({ unpackedObject });
// Console:
// packedObject: {
// name: 'Billy Russo',
// age: 38,
// cashOnHand: 4500,
// isDeceased: false,
// heightInMeeters: 1.9,
// hasScars: true,
// canFeelLove: false,
// isHospitalized: false,
// isDeceased: false,
// hasBankAccount: true
// }
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 was computed. 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 was computed. 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 | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.