Class Selectors
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
valueTThe provided object.
Returns
- T
default, ignoring the provided object.
Type Parameters
TThe 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
kvpKeyValuePair<TKey, TValue>The provided KeyValuePair<TKey, TValue> object.
Returns
- TKey
The key stored in the KeyValuePair<TKey, TValue> object.
Type Parameters
TKeyThe type of the key.
TValueThe 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
valueTThe provided object.
Returns
- T
null, ignoring the provided object.
Type Parameters
TThe 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
valueTThe provided object.
Returns
- T
The provided object without manipulating it.
Type Parameters
TThe 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
valueT?The provided nullable struct object.
Returns
- T
The value stored in the nullable struct object.
Type Parameters
TThe 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
valueT?The provided nullable struct object.
Returns
- T
The value stored in the nullable struct object.
Type Parameters
TThe 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
kvpKeyValuePair<TKey, TValue>The provided KeyValuePair<TKey, TValue> object.
Returns
- TValue
The value stored in the KeyValuePair<TKey, TValue> object.
Type Parameters
TKeyThe type of the key.
TValueThe type of the value.