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
TType of the concept.
- Inheritance
-
ConceptAs<T>
- Implements
-
IComparable<ConceptAs<T>>IComparable<T>IEquatable<ConceptAs<T>>
- Derived
- Inherited Members
- Extension Methods
Constructors
ConceptAs(ConceptAs<T>)
protected ConceptAs(ConceptAs<T> original)
Parameters
originalConceptAs<T>
ConceptAs(T)
Initializes a new instance of ConceptAs<T>.
public ConceptAs(T value)
Parameters
valueTValue to initialize the concept with.
Exceptions
- ArgumentNullException
Thrown when incoming value is null.
Properties
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
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
otherConceptAs<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
objobjectInstance 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
otherTInstance 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
otherConceptAs<T>
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
public override sealed string ToString()
Returns
Operators
operator ==(ConceptAs<T>?, ConceptAs<T>?)
public static bool operator ==(ConceptAs<T>? left, ConceptAs<T>? right)
Parameters
Returns
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
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
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
valueConceptAs<T>ConceptAs<T> to convert from.
Returns
- T
operator !=(ConceptAs<T>?, ConceptAs<T>?)
public static bool operator !=(ConceptAs<T>? left, ConceptAs<T>? right)
Parameters
Returns
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
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
Returns
- bool
true if the first instance is less than or equal to the second, otherwise false.