Class RegisterParameterBuilder<T>
Builder class for constructing instances of ParameterState<T>.
public class RegisterParameterBuilder<T>
Type Parameters
TThe type of the component's property value.
- Inheritance
-
RegisterParameterBuilder<T>
- Inherited Members
- Extension Methods
Constructors
RegisterParameterBuilder()
Initializes a new instance of the RegisterParameterBuilder<T> class.
public RegisterParameterBuilder()
Methods
WithChangeHandler(IParameterChangedHandler<T>, string?)
Sets the parameter changed handler for the parameter.
public RegisterParameterBuilder<T> WithChangeHandler(IParameterChangedHandler<T> parameterChangedHandler, string? handlerName = null)
Parameters
parameterChangedHandlerIParameterChangedHandler<T>The parameter changed handler.
handlerNamestringThe handler's name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
WithChangeHandler(Action, string?)
Sets the parameter changed handler for the parameter.
public RegisterParameterBuilder<T> WithChangeHandler(Action parameterChangedHandler, string? handlerName = null)
Parameters
parameterChangedHandlerActionThe parameter changed handler.
handlerNamestringThe handler's name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
WithChangeHandler(Action<ParameterChangedEventArgs<T>>, string?)
Sets the parameter changed handler for the parameter.
public RegisterParameterBuilder<T> WithChangeHandler(Action<ParameterChangedEventArgs<T>> parameterChangedHandler, string? handlerName = null)
Parameters
parameterChangedHandlerAction<ParameterChangedEventArgs<T>>The parameter changed handler.
handlerNamestringThe handler's name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
WithChangeHandler(Func<ParameterChangedEventArgs<T>, Task>, string?)
Sets the parameter changed handler for the parameter.
public RegisterParameterBuilder<T> WithChangeHandler(Func<ParameterChangedEventArgs<T>, Task> parameterChangedHandler, string? handlerName = null)
Parameters
parameterChangedHandlerFunc<ParameterChangedEventArgs<T>, Task>The parameter changed handler.
handlerNamestringThe handler's name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
WithChangeHandler(Func<Task>, string?)
Sets the parameter changed handler for the parameter.
public RegisterParameterBuilder<T> WithChangeHandler(Func<Task> parameterChangedHandler, string? handlerName = null)
Parameters
parameterChangedHandlerFunc<Task>The parameter changed handler.
handlerNamestringThe handler's name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
WithComparer(IEqualityComparer<T>?)
Sets the comparer for the parameter.
public RegisterParameterBuilder<T> WithComparer(IEqualityComparer<T>? comparer)
Parameters
comparerIEqualityComparer<T>The comparer for the parameter.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
Remarks
This method is used when you need to register a static IEqualityComparer<T> that doesn't change during ParameterState<T> lifespan.
WithComparer(Func<IEqualityComparer<T>>?, string?)
Sets the function to provide the comparer for the parameter.
public RegisterParameterBuilder<T> WithComparer(Func<IEqualityComparer<T>>? comparerFunc, string? comparerParameterName = null)
Parameters
comparerFuncFunc<IEqualityComparer<T>>The function to provide the comparer for the parameter.
comparerParameterNamestringThe parameter's comparer name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
Remarks
This method should be used exclusively when the parameter has an associated IEqualityComparer<T> that is also declared as a Blazor ParameterAttribute.
WithComparer<TFrom>(Func<IEqualityComparer<TFrom>>, Func<IEqualityComparer<TFrom>, IEqualityComparer<T>>, string?)
Sets the function to provide the comparer for the parameter, converting it to a comparer of type T.
public RegisterParameterBuilder<T> WithComparer<TFrom>(Func<IEqualityComparer<TFrom>> comparerFromFunc, Func<IEqualityComparer<TFrom>, IEqualityComparer<T>> comparerToFunc, string? comparerParameterName = null)
Parameters
comparerFromFuncFunc<IEqualityComparer<TFrom>>The function to provide the original comparer.
comparerToFuncFunc<IEqualityComparer<TFrom>, IEqualityComparer<T>>The function to convert the original comparer to a comparer of type
T.comparerParameterNamestringThe parameter's comparer name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
Type Parameters
TFromThe type of the original comparer.
WithEventCallback(Func<EventCallback<T>>)
Sets the function to create the event callback for the parameter.
public RegisterParameterBuilder<T> WithEventCallback(Func<EventCallback<T>> eventCallbackFunc)
Parameters
eventCallbackFuncFunc<EventCallback<T>>The function to create the event callback.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
WithName(string)
Sets the metadata for the parameter.
public RegisterParameterBuilder<T> WithName(string parameterName)
Parameters
parameterNamestringThe name of the parameter, passed using nameof(...).
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
WithParameter(Func<T>)
Sets the function to get the parameter value.
public RegisterParameterBuilder<T> WithParameter(Func<T> getParameterValueFunc)
Parameters
getParameterValueFuncFunc<T>The function to get the parameter value.
Returns
- RegisterParameterBuilder<T>
The current instance of the builder.
Operators
implicit operator ParameterState<T>(RegisterParameterBuilder<T>)
Implicitly converts a RegisterParameterBuilder<T> object to a ParameterState<T> object by building it.
public static implicit operator ParameterState<T>(RegisterParameterBuilder<T> builder)
Parameters
builderRegisterParameterBuilder<T>The RegisterParameterBuilder<T> object to convert.
Returns
- ParameterState<T>
The created ParameterState<T> object.