| NiceFormatterSample(Byte, Int32) Method |
Converts a buffer into a nicely formatted string where leading and trailing bytes of a maximum length are
displayed, but excess middle bytes are replaced with a count placeholder. It therefore displays a sample
of a buffer of arbitrary length. The middle truncation is skipped if it is less than 8 bytes long.
Namespace: Orthogonal.Common.BasicAssembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 2024-04-15 18:00 GMT+10.f27da1471008deaf16b803c17e24a5955690aef1
Syntax public static string Sample(
this byte[] buffer,
int sampleLength = 32
)
Parameters
- buffer Byte
- The buffer to nicely format as a sample.
- sampleLength Int32 (Optional)
- The length of the leading and trailing bytes to be shown as a sample of the buffer.
Return Value
StringA string representation sample of a buffer.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Byte. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Example
var buff = new byte[1000];
string sample = buff.Sample(8);
Console.WriteLine(sample);
See Also