Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Type Constraints #18

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Immediate.Validations.Shared/IValidationTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Immediate.Validations.Shared;
/// <typeparam name="T">
/// The type which should be validated.
/// </typeparam>
public interface IValidationTarget<T> where T : IValidationTarget<T>
public interface IValidationTarget<T>
{
/// <summary>
/// A method which can be used to validate instances of the type <typeparamref name="T"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ object operand
/// A <see cref="ValueTuple{T1, T2}"/> indicating whether the property is valid or not, along with an error
/// message if the property is not valid.
/// </returns>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand)
where T : IComparable<T> =>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand) =>
Comparer<T>.Default.Compare(target, operand) > 0
? default
: (true, $"Value '{target}' is not greater than '{operand}'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ object operand
/// A <see cref="ValueTuple{T1, T2}"/> indicating whether the property is valid or not, along with an error
/// message if the property is not valid.
/// </returns>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand)
where T : IComparable<T> =>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand) =>
Comparer<T>.Default.Compare(target, operand) >= 0
? default
: (true, $"Value '{target}' is not greater than or equal to '{operand}'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ object operand
/// A <see cref="ValueTuple{T1, T2}"/> indicating whether the property is valid or not, along with an error
/// message if the property is not valid.
/// </returns>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand)
where T : IComparable<T> =>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand) =>
Comparer<T>.Default.Compare(target, operand) < 0
? default
: (true, $"Value '{target}' is not less than '{operand}'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ object operand
/// A <see cref="ValueTuple{T1, T2}"/> indicating whether the property is valid or not, along with an error
/// message if the property is not valid.
/// </returns>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand)
where T : IComparable<T> =>
public static (bool Invalid, string? Message) ValidateProperty<T>(T target, T operand) =>
Comparer<T>.Default.Compare(target, operand) <= 0
? default
: (true, $"Value '{target}' is not less than or equal to '{operand}'");
Expand Down
Loading