Class DataFormatter
Provides functions for printing bytes to various output devices. This class cannot be inherited.
Inheritance
Inherited Members
Namespace: MBNCSUtil
Assembly: MBNCSUtil.dll
Syntax
public static class DataFormatter
Examples
This example demonstrates how the formatter prints out binary data.
DataFormatter.WriteToConsole(XSha1.CalculateHash(Encoding.ASCII.GetBytes("password")));
Output:
0000 ec c8 0d 1d 76 e7 58 c0 b9 da 8c 25 ff 10 6a ff ìE..vçXA.U.%ÿ.jÿ
0010 8e 24 29 16 .$).
Methods
| Improve this Doc View SourceFormat(Byte[])
Formats a data into 16-byte rows followed by an ASCII representation.
Declaration
public static string Format(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to format. |
Returns
Type | Description |
---|---|
System.String | A string representing the data. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if data is null (Nothing in Visual Basic). |
WriteToConsole(Byte[])
Writes a series of bytes to the console, printing them in 16-byte rows followed by an ASCII representation.
Declaration
public static void WriteToConsole(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to print. |
WriteToTrace(Byte[])
Writes a series of bytes to trace listeners, printing them in 16-byte rows, followed by an ASCII representation.
Declaration
public static void WriteToTrace(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to print. |
WriteToTrace(Byte[], String)
Writes a series of bytes to trace listeners, printing them in 16-byte rows, followed by an ASCII representation.
Declaration
public static void WriteToTrace(byte[] data, string category)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to print. |
System.String | category | A category name to classify the data. |