Table of Contents

Class FixedWidth

Namespace
Pamoja.Native.Interop
Assembly
Pamoja.Native.dll

Checks a fixed-width argument before a native call reads it.

public static class FixedWidth
Inheritance
FixedWidth
Inherited Members

Remarks

A native call that takes a key, an identifier, or a signature reads a fixed number of bytes from the pointer it is given, with no length to check them against. A span of any other length is refused here, before it crosses.

Methods

Require(ReadOnlySpan<byte>, int, string)

Throws unless value is exactly length bytes.

public static void Require(ReadOnlySpan<byte> value, int length, string name)

Parameters

value ReadOnlySpan<byte>

The argument.

length int

The number of bytes the native call reads.

name string

The argument's name, for the exception.

Exceptions

ArgumentException

value is another length.