Class FixedWidth
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
valueReadOnlySpan<byte>The argument.
lengthintThe number of bytes the native call reads.
namestringThe argument's name, for the exception.
Exceptions
- ArgumentException
valueis another length.