Struct FourBitNumber
Type that is used to represent a four-bit number (0-15; or in binary format 0000-1111).
Assembly: Melanchall.DryWetMidi.dll
Syntax
public struct FourBitNumber : IComparable<FourBitNumber>, IConvertible
Examples
For example, to set a note's channel:
var noteOnEvent = new NoteOnEvent();
noteOnEvent.Channel = (FourBitNumber)10;
Constructors
FourBitNumber(byte)
Initializes a new instance of the
FourBitNumber with the specified value.
Declaration
public FourBitNumber(byte value)
Parameters
Type |
Name |
Description |
byte |
value |
Value representing four-bit number. |
Exceptions
Fields
MaxValue
Declaration
public static readonly FourBitNumber MaxValue
Field Value
MinValue
Declaration
public static readonly FourBitNumber MinValue
Field Value
Values
Declaration
public static readonly FourBitNumber[] Values
Field Value
Methods
CompareTo(FourBitNumber)
Compares the current instance with another object of the same type and returns
an integer that indicates whether the current instance precedes, follows, or
occurs in the same position in the sort order as the other object.
Declaration
public int CompareTo(FourBitNumber other)
Parameters
Type |
Name |
Description |
FourBitNumber |
other |
An object to compare with this instance. |
Returns
Type |
Description |
int |
A value that indicates the relative order of the objects being compared. The
return value has these meanings:
Value | Meaning |
---|
Less than zero | This instance precedes other in the sort order. | Zero | This instance occurs in the same position in the sort order as other . | Greater than zero | This instance follows other in the sort order. |
|
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
object |
obj |
The object to compare with the current object. |
Returns
Type |
Description |
bool |
true if the specified object is equal to the current object; otherwise, false . |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
int |
A hash code for the current object. |
Overrides
GetTypeCode()
Declaration
public TypeCode GetTypeCode()
Returns
Parse(string)
Converts the string representation of a four-bit number to its
FourBitNumber equivalent.
Declaration
public static FourBitNumber Parse(string input)
Parameters
Type |
Name |
Description |
string |
input |
A string containing a number to convert. |
Returns
Exceptions
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type |
Description |
string |
A string that represents the current object. |
Overrides
TryParse(string, out FourBitNumber)
Converts the string representation of a four-bit number to its
FourBitNumber equivalent.
A return value indicates whether the conversion succeeded.
Declaration
public static bool TryParse(string input, out FourBitNumber fourBitNumber)
Parameters
Type |
Name |
Description |
string |
input |
A string containing a number to convert. |
FourBitNumber |
fourBitNumber |
When this method returns, contains the FourBitNumber
equivalent of the four-bit number contained in input , if the conversion succeeded,
or zero if the conversion failed. The conversion fails if the input is null or
Empty, or is not of the correct format. This parameter is passed uninitialized;
any value originally supplied in result will be overwritten. |
Returns
Type |
Description |
bool |
true if input was converted successfully; otherwise, false . |
Operators
explicit operator FourBitNumber(byte)
Declaration
public static explicit operator FourBitNumber(byte number)
Parameters
Returns
Exceptions
implicit operator byte(FourBitNumber)
Declaration
public static implicit operator byte(FourBitNumber number)
Parameters
Returns
Type |
Description |
byte |
number represented as byte. |
Implements