Class ConceptAs<T>

Namespace
Cratis.Concepts
Assembly
Cratis.Fundamentals.dll

Expresses a Concept as a another type, usually a primitive such as Guid, Int or String.

public record ConceptAs<T> : IComparable<ConceptAs<T>>, IComparable<T>, IComparable, IEquatable<ConceptAs<T>> where T : IComparable

Type Parameters

T

Type of the concept.

Inheritance
ConceptAs<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

ConceptAs(ConceptAs<T>)

protected ConceptAs(ConceptAs<T> original)

Parameters

original ConceptAs<T>

ConceptAs(T)

Initializes a new instance of ConceptAs<T>.

public ConceptAs(T value)

Parameters

value T

Value to initialize the concept with.

Exceptions

ArgumentNullException

Thrown when incoming value is null.

Properties

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Value

Gets or inits the underlying value for the instance.

public T Value { get; init; }

Property Value

T

Methods

CompareTo(ConceptAs<T>?)

Compares two instances of ConceptAs'T to determine sort order.

public int CompareTo(ConceptAs<T>? other)

Parameters

other ConceptAs<T>

Instance to compare to.

Returns

int

Greater than 0 if greater, 0 if the same and less than 0 if lesser.

CompareTo(object?)

Compares instance to an object to determine sort order.

public int CompareTo(object? obj)

Parameters

obj object

Instance to compare to.

Returns

int

Greater than 0 if greater, 0 if the same and less than 0 if lesser.

CompareTo(T?)

Compares instance to an instance of T to determine sort order.

public int CompareTo(T? other)

Parameters

other T

Instance to compare to.

Returns

int

Greater than 0 if greater, 0 if the same and less than 0 if lesser.

Equals(ConceptAs<T>?)

public virtual bool Equals(ConceptAs<T>? other)

Parameters

other ConceptAs<T>

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override sealed string ToString()

Returns

string

Operators

operator ==(ConceptAs<T>?, ConceptAs<T>?)

public static bool operator ==(ConceptAs<T>? left, ConceptAs<T>? right)

Parameters

left ConceptAs<T>
right ConceptAs<T>

Returns

bool

operator >(ConceptAs<T>, ConceptAs<T>)

Checks if the first instance of ConceptAs<T> is greater than the second.

public static bool operator >(ConceptAs<T> first, ConceptAs<T> second)

Parameters

first ConceptAs<T>

First instance to compare.

second ConceptAs<T>

Second instance to compare.

Returns

bool

true if the first instance is greater than the second, otherwise false.

operator >=(ConceptAs<T>, ConceptAs<T>)

Checks if the first instance of ConceptAs<T> is greater than or equal to the second.

public static bool operator >=(ConceptAs<T> first, ConceptAs<T> second)

Parameters

first ConceptAs<T>

First instance to compare.

second ConceptAs<T>

Second instance to compare.

Returns

bool

true if the first instance is greater than or equal to the second, otherwise false.

implicit operator T(ConceptAs<T>)

Implicitly convert from the ConceptAs<T> to the value of the type given.

public static implicit operator T(ConceptAs<T> value)

Parameters

value ConceptAs<T>

ConceptAs<T> to convert from.

Returns

T

operator !=(ConceptAs<T>?, ConceptAs<T>?)

public static bool operator !=(ConceptAs<T>? left, ConceptAs<T>? right)

Parameters

left ConceptAs<T>
right ConceptAs<T>

Returns

bool

operator <(ConceptAs<T>, ConceptAs<T>)

Checks if the first instance of ConceptAs<T> is less than the second.

public static bool operator <(ConceptAs<T> first, ConceptAs<T> second)

Parameters

first ConceptAs<T>

First instance to compare.

second ConceptAs<T>

Second instance to compare.

Returns

bool

true if the first instance is less than the second, otherwise false.

operator <=(ConceptAs<T>, ConceptAs<T>)

Checks if the first instance of ConceptAs<T> is less than or equal to the second.

public static bool operator <=(ConceptAs<T> first, ConceptAs<T> second)

Parameters

first ConceptAs<T>

First instance to compare.

second ConceptAs<T>

Second instance to compare.

Returns

bool

true if the first instance is less than or equal to the second, otherwise false.