Skip to content

Izayoi.Data.Comparable.ComparableEnum

IzayoiJiichan edited this page Feb 1, 2025 · 2 revisions

ComparableEnum<TEnum>

Definition

Namespace Izayoi.Data.Comparable
Assembly Izayoi.Data.Comparable.dll

Represents a comparable enum type that can be assigned null.

public class ComparableEnum<TEnum> :
    IComparableEnum<TEnum>
    where TEnum : Enum

Type Parameters

TEnum
The underlying value type of the ComparableEnum<TEnum> generic type.

Inheritance

Object -> ValueType -> Enum -> ComparableEnum<TEnum>

Constructors

Name Summary
ComparableEnum<TEnum>() Initializes an instance of the ComparableEnum<TEnum> class.
ComparableEnum<TEnum>(in TEnum value) Initializes an instance of the ComparableEnum<TEnum> class to the specified value.

Properties

Name Type Summary
Value TEnum Gets the value of the current ComparableEnum<TEnum> object if it has been assigned a valid underlying value.

Methods

Name Returns Summary
CompareTo(ComparableEnum<TEnum>? other) int Compares this instance to a specified ComparableEnum<TEnum> and returns an indication of their relative values.
CompareTo(object? other) int Compares this instance to a specified object and returns an indication of their relative values.
Equals(ComparableEnum<TEnum>? other) bool Indicates whether the current ComparableEnum<TEnum> object is equal to a specified ComparableEnum<TEnum>.
Equals(object? other) bool Indicates whether the current ComparableEnum<TEnum> object is equal to a specified object.
GetHashCode() string Returns the hash code for this instance.
GetValueOrDefault() TEnum Retrieves the value of the current ComparableEnum<TEnum> object, or the default value of the underlying type.
GetValueOrDefault(TEnum defaultValue) TEnum Retrieves the value of the current ComparableEnum<TEnum> object, or the specified default value.
HasFlag(TEnum flag) bool Determines whether one or more bit fields are set in the current instance.
ToString() string? Returns the text representation of the value of the current ComparableEnum<TEnum> object.

Operators

Operator Returns Left Right
== bool ComparableEnum<TEnum> ComparableEnum<TEnum>
!= bool ComparableEnum<TEnum> ComparableEnum<TEnum>
< bool ComparableEnum<TEnum> ComparableEnum<TEnum>
<= bool ComparableEnum<TEnum> ComparableEnum<TEnum>
> bool ComparableEnum<TEnum> ComparableEnum<TEnum>
>= bool ComparableEnum<TEnum> ComparableEnum<TEnum>
Type From To
implicit TEnum ComparableEnum<TEnum>
explicit ComparableEnum<TEnum> TEnum

Examples

Example.ComparableEnum

Applies to

Product Versions
.NET 8, 9
.NET Standard 2.0, 2.1
Clone this wiki locally