Table of Contents

Class FluentExtensions

Namespace
Utils.Objects
Assembly
Utils.dll

Provides extension methods for fluent validation and processing of objects.

public static class FluentExtensions
Inheritance
FluentExtensions
Inherited Members

Methods

Failure<T>(T)

Marks the operation as failed with the provided value.

public static FluentResult<T> Failure<T>(this T value)

Parameters

value T

The value to be wrapped.

Returns

FluentResult<T>

A FluentResult<T> indicating failure.

Type Parameters

T

The type of the value.

IsEqualTo<T, CT>(T, CT)

Checks if the provided value is equal to the comparison value.

public static FluentResult<T> IsEqualTo<T, CT>(this T value, CT comparisonValue)

Parameters

value T

The value to check.

comparisonValue CT

The value to compare against.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the values are equal.

Type Parameters

T

The type of the value.

CT

The type of the comparison value.

IsGreaterOrEqualsThan<T, CT>(T, CT)

Checks if the provided value is greater than or equal to the comparison value.

public static FluentResult<T> IsGreaterOrEqualsThan<T, CT>(this T value, CT comparisonValue)

Parameters

value T

The value to check.

comparisonValue CT

The value to compare against.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is greater than or equal to the comparison value.

Type Parameters

T

The type of the value.

CT

The type of the comparison value.

IsGreaterThan<T, CT>(T, CT)

Checks if the provided value is greater than the comparison value.

public static FluentResult<T> IsGreaterThan<T, CT>(this T value, CT comparisonValue)

Parameters

value T

The value to check.

comparisonValue CT

The value to compare against.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is greater than the comparison value.

Type Parameters

T

The type of the value.

CT

The type of the comparison value.

IsIn<T>(T, params T[])

Checks if the provided value is present in a list of values.

public static FluentResult<T> IsIn<T>(this T value, params T[] values)

Parameters

value T

The value to check.

values T[]

An array of values to check against.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is in the list.

Type Parameters

T

The type of the value.

IsLowerOrEqualsThan<T, CT>(T, CT)

Checks if the provided value is less than or equal to the comparison value.

public static FluentResult<T> IsLowerOrEqualsThan<T, CT>(this T value, CT comparisonValue)

Parameters

value T

The value to check.

comparisonValue CT

The value to compare against.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is less than or equal to the comparison value.

Type Parameters

T

The type of the value.

CT

The type of the comparison value.

IsLowerThan<T, CT>(T, CT)

Checks if the provided value is less than the comparison value.

public static FluentResult<T> IsLowerThan<T, CT>(this T value, CT comparisonValue)

Parameters

value T

The value to check.

comparisonValue CT

The value to compare against.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is less than the comparison value.

Type Parameters

T

The type of the value.

CT

The type of the comparison value.

IsNotIn<T>(T, params T[])

Checks if the provided value is not present in a list of values.

public static FluentResult<T> IsNotIn<T>(this T value, params T[] values)

Parameters

value T

The value to check.

values T[]

An array of values to check against.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is not in the list.

Type Parameters

T

The type of the value.

IsNotNull<T>(T)

Checks if the provided value is not null.

public static FluentResult<T> IsNotNull<T>(this T value)

Parameters

value T

The value to check.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is not null.

Type Parameters

T

The type of the value.

IsNull<T>(T)

Checks if the provided value is null.

public static FluentResult<T> IsNull<T>(this T value)

Parameters

value T

The value to check.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the value is null.

Type Parameters

T

The type of the value.

NullOrEmptyToNull(string)

Converts an empty or null string to null.

public static string NullOrEmptyToNull(this string value)

Parameters

value string

The string to check.

Returns

string

Null if the string is null or empty, otherwise the original string.

NullOrEmptyToNull(FluentResult<string>)

Converts an empty or null string to null within a FluentResult<T>.

public static FluentResult<string> NullOrEmptyToNull(this FluentResult<string> value)

Parameters

value FluentResult<string>

The fluent result containing the string.

Returns

FluentResult<string>

A new FluentResult<T> with the string converted to null if it was null or empty.

NullOrWhiteSpaceToNull(string)

Converts a whitespace-only or null string to null.

public static string NullOrWhiteSpaceToNull(this string value)

Parameters

value string

The string to check.

Returns

string

Null if the string is null or contains only whitespace, otherwise the original string.

NullOrWhiteSpaceToNull(FluentResult<string>)

Converts a whitespace-only or null string to null within a FluentResult<T>.

public static FluentResult<string> NullOrWhiteSpaceToNull(this FluentResult<string> value)

Parameters

value FluentResult<string>

The fluent result containing the string.

Returns

FluentResult<string>

A new FluentResult<T> with the string converted to null if it was null or whitespace-only.

Success<T>(T)

Marks the operation as successful with the provided value.

public static FluentResult<T> Success<T>(this T value)

Parameters

value T

The value to be wrapped.

Returns

FluentResult<T>

A FluentResult<T> indicating success.

Type Parameters

T

The type of the value.

Test<T>(T, Func<T, bool>)

Checks if the provided value satisfies a given predicate.

public static FluentResult<T> Test<T>(this T value, Func<T, bool> test)

Parameters

value T

The value to check.

test Func<T, bool>

The predicate to apply.

Returns

FluentResult<T>

A FluentResult<T> indicating whether the predicate is satisfied.

Type Parameters

T

The type of the value.