Class BinaryRepresentationExtensions
- Namespace
- Garyon.Extensions
- Assembly
- Garyon.dll
Provides extensions for the binary representation of values.
public static class BinaryRepresentationExtensions
- Inheritance
-
BinaryRepresentationExtensions
- Inherited Members
Methods
GetBinaryRepresentation(byte, int)
Gets the binary representation of the byte value.
public static string GetBinaryRepresentation(this byte value, int totalBits = 8)
Parameters
valuebyteThe value.
totalBitsintThe total bits to display. Defaults to the number of bits a byte value contains.
Returns
- string
The binary representation of the value.
GetBinaryRepresentation(short, int)
Gets the binary representation of the short value.
public static string GetBinaryRepresentation(this short value, int totalBits = 16)
Parameters
valueshortThe value.
totalBitsintThe total bits to display. Defaults to the number of bits a short value contains.
Returns
- string
The binary representation of the value.
GetBinaryRepresentation(int, int)
Gets the binary representation of the int value.
public static string GetBinaryRepresentation(this int value, int totalBits = 32)
Parameters
valueintThe value.
totalBitsintThe total bits to display. Defaults to the number of bits an int value contains.
Returns
- string
The binary representation of the value.
GetBinaryRepresentation(long, int)
Gets the binary representation of the long value.
public static string GetBinaryRepresentation(this long value, int totalBits = 64)
Parameters
valuelongThe value.
totalBitsintThe total bits to display. Defaults to the number of bits a long value contains.
Returns
- string
The binary representation of the value.
GetBinaryRepresentation(sbyte, int)
Gets the binary representation of the sbyte value.
public static string GetBinaryRepresentation(this sbyte value, int totalBits = 8)
Parameters
valuesbyteThe value.
totalBitsintThe total bits to display. Defaults to the number of bits a sbyte value contains.
Returns
- string
The binary representation of the value.
GetBinaryRepresentation(ushort, int)
Gets the binary representation of the ushort value.
public static string GetBinaryRepresentation(this ushort value, int totalBits = 16)
Parameters
valueushortThe value.
totalBitsintThe total bits to display. Defaults to the number of bits a ushort value contains.
Returns
- string
The binary representation of the value.
GetBinaryRepresentation(uint, int)
Gets the binary representation of the uint value.
public static string GetBinaryRepresentation(this uint value, int totalBits = 32)
Parameters
valueuintThe value.
totalBitsintThe total bits to display. Defaults to the number of bits a uint value contains.
Returns
- string
The binary representation of the value.
GetBinaryRepresentation(ulong, int)
Gets the binary representation of the ulong value.
public static string GetBinaryRepresentation(this ulong value, int totalBits = 64)
Parameters
valueulongThe value.
totalBitsintThe total bits to display. Defaults to the number of bits a ulong value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(byte, int, int)
Gets the binary representation of the byte value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this byte value, int groupLength, int totalBits = 8)
Parameters
valuebyteThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a byte value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(short, int, int)
Gets the binary representation of the short value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this short value, int groupLength, int totalBits = 16)
Parameters
valueshortThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a short value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(int, int, int)
Gets the binary representation of the int value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this int value, int groupLength, int totalBits = 32)
Parameters
valueintThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a int value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(long, int, int)
Gets the binary representation of the long value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this long value, int groupLength, int totalBits = 64)
Parameters
valuelongThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a long value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(sbyte, int, int)
Gets the binary representation of the sbyte value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this sbyte value, int groupLength, int totalBits = 8)
Parameters
valuesbyteThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a sbyte value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(ushort, int, int)
Gets the binary representation of the ushort value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this ushort value, int groupLength, int totalBits = 16)
Parameters
valueushortThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a ushort value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(uint, int, int)
Gets the binary representation of the uint value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this uint value, int groupLength, int totalBits = 32)
Parameters
valueuintThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a uint value contains.
Returns
- string
The binary representation of the value.
GetGroupedBinaryRepresentation(ulong, int, int)
Gets the binary representation of the ulong value, while also grouping the digits.
public static string GetGroupedBinaryRepresentation(this ulong value, int groupLength, int totalBits = 64)
Parameters
valueulongThe value.
groupLengthintThe length of each digit group in the resulting binary representation. Must be non-negative. If 0, no grouping is performed.
totalBitsintThe total bits to display. Defaults to the number of bits a ulong value contains.
Returns
- string
The binary representation of the value.