Table of Contents

Class StringEnum<T>

Namespace
Mailtrap.Core.Models
Assembly
Mailtrap.Abstractions.dll

Generic string enum implementation.

public abstract record StringEnum<T> : IEquatable<StringEnum<T>> where T : StringEnum<T>, new()

Type Parameters

T

Particular StringEnum<T> implementation type.

Inheritance
StringEnum<T>
Implements
Derived

Properties

None

Gets empty enum value.

public static T None { get; }

Property Value

T

Empty value.

Unknown

Gets unknown enum value.
E.g. that cannot be parsed.

public static T Unknown { get; }

Property Value

T

Unknown value.

Methods

Define(string)

Defines new enum entry and adds it to the values dictionary.

protected static T Define(string value)

Parameters

value string

Enum entry value.

Returns

T

Created enum entry instance.

Equals(T?)

public virtual bool Equals(T? other)

Parameters

other T

Returns

bool

Find(string?)

Finds enum entry by the specified string value.

public static T Find(string? value)

Parameters

value string

String value to find enum entry for.

Returns

T

Enum entry for the specified string value if found, null otherwise.

Remarks

Search is case-sensitive.

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override sealed string ToString()

Returns

string