Table of Contents

Class Selectors

Namespace
Garyon.Functions
Assembly
Garyon.dll

Contains functions that can be used as selectors in functions that manipulate objects. Using these functions is advised over lambdas, as lambdas create a new delegate instance, effectively reducing performance.

public static class Selectors
Inheritance
Selectors
Inherited Members

Methods

DefaultValueReturner<T>(T)

Returns default without caring about the provided object.

public static T? DefaultValueReturner<T>(T value)

Parameters

value T

The provided object.

Returns

T

default, ignoring the provided object.

Type Parameters

T

The type of the object.

KeyReturner<TKey, TValue>(KeyValuePair<TKey, TValue>)

Returns the key in a KeyValuePair<TKey, TValue> object.

public static TKey KeyReturner<TKey, TValue>(KeyValuePair<TKey, TValue> kvp)

Parameters

kvp KeyValuePair<TKey, TValue>

The provided KeyValuePair<TKey, TValue> object.

Returns

TKey

The key stored in the KeyValuePair<TKey, TValue> object.

Type Parameters

TKey

The type of the key.

TValue

The type of the value.

NullReturner<T>(T)

Returns null without caring about the provided object.

public static T? NullReturner<T>(T value) where T : class

Parameters

value T

The provided object.

Returns

T

null, ignoring the provided object.

Type Parameters

T

The type of the object. Must be a reference type.

SelfObjectReturner<T>(T)

Returns the provided object without performing any manipulations.

public static T SelfObjectReturner<T>(T value)

Parameters

value T

The provided object.

Returns

T

The provided object without manipulating it.

Type Parameters

T

The type of the object.

ValueOrDefaultReturner<T>(T?)

Returns the value in a nullable struct object, if it has any, otherwise default.

public static T ValueOrDefaultReturner<T>(T? value) where T : struct

Parameters

value T?

The provided nullable struct object.

Returns

T

The value stored in the nullable struct object.

Type Parameters

T

The type of the struct.

ValueReturner<T>(T?)

Returns the value in a nullable struct object without checking whether it has a value.

public static T ValueReturner<T>(T? value) where T : struct

Parameters

value T?

The provided nullable struct object.

Returns

T

The value stored in the nullable struct object.

Type Parameters

T

The type of the struct.

Remarks

ValueOrDefaultReturner<T>(T?) checks for whether the nullable struct object has a value.

ValueReturner<TKey, TValue>(KeyValuePair<TKey, TValue>)

Returns the value in a KeyValuePair<TKey, TValue> object.

public static TValue ValueReturner<TKey, TValue>(KeyValuePair<TKey, TValue> kvp)

Parameters

kvp KeyValuePair<TKey, TValue>

The provided KeyValuePair<TKey, TValue> object.

Returns

TValue

The value stored in the KeyValuePair<TKey, TValue> object.

Type Parameters

TKey

The type of the key.

TValue

The type of the value.