Class Radix
Represents a number base for a given value type or atomic type.
public abstract class Radix : LogixEnum<Radix, string>, IEquatable<LogixEnum<Radix, string>>, IComparable<LogixEnum<Radix, string>>
- Inheritance
-
Radix
- Implements
- Inherited Members
Fields
Ascii
Represents a Ascii number base format.
public static readonly Radix Ascii
Field Value
Binary
Represents a Binary number base format.
public static readonly Radix Binary
Field Value
DateTime
Represents a DateTime number base format.
public static readonly Radix DateTime
Field Value
DateTimeNs
Represents a DateTimeNs number base format.
public static readonly Radix DateTimeNs
Field Value
Decimal
Represents a Decimal number base format.
public static readonly Radix Decimal
Field Value
Exponential
Represents a Exponential number base format.
public static readonly Radix Exponential
Field Value
Float
Represents a Float number base format.
public static readonly Radix Float
Field Value
Hex
Represents a Hexadecimal number base format.
public static readonly Radix Hex
Field Value
Null
Represents a Null radix, or absence of a Radix value.
public static readonly Radix Null
Field Value
Remarks
Only AtomicType types have non-null Radix. StructureType types all have null Radix.
Octal
Represents a Octal number base format.
public static readonly Radix Octal
Field Value
Properties
Specifier
The specifier prefix of the Radix string format.
protected abstract string Specifier { get; }
Property Value
Remarks
Most Radix will have a specifier prefix, such as '#2' for Binary, '#16' for Hex, and so on. By default this property is used by HasFormat(string) to determine if an input string has the specified Radix format, and further by Infer(string) to determine a Radix from a string value. However, some Radix options are overriden as they do not have specifiers (e.g. Decimal, Float).
Methods
Default(LogixType)
Gets the default Radix value for the provided logix type.
public static Radix Default(LogixType type)
Parameters
type
LogixTypeThe logix type to evaluate.
Returns
Format(AtomicType)
Converts an atomic value to the current radix base format.
public abstract string Format(AtomicType atomic)
Parameters
atomic
AtomicTypeThe current atomic type to convert.
Returns
- string
A string that represents the value of the atomic type in the current radix base number style.
HasFormat(string)
Returns an indication as to whether the current string input value has the format of the current Radix type.
protected virtual bool HasFormat(string input)
Parameters
input
stringThe input text value to examine.
Returns
- bool
true
ifinput
qualifies as a valid format for the Radix type; otherwise,false
.
Infer(string)
Determines the radix format from a string representing a formatted atomic value.
public static Radix Infer(string input)
Parameters
input
stringThe string for which to infer the format.
Returns
Exceptions
- FormatException
A radix can not be determined from the format of
value
.
Parse(string)
Parses a string input of a given Radix formatted value into an atomic value type.
public abstract AtomicType Parse(string input)
Parameters
input
stringThe string value to parse.
Returns
- AtomicType
An AtomicType representing the value of the formatted string.
SupportsType(LogixType)
Determines if the current Radix supports the provided data type instance.
public bool SupportsType(LogixType type)
Parameters
type
LogixTypeThe logix type instance to evaluate.
Returns
- bool
true if the current radix value is valid for the given data type instance; otherwise, false.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.