Table of Contents

Class ComponentBaseWithStateExtensions

Namespace
MudBlazor.Extensions
Assembly
MudBlazor.dll

Provides extension methods for ComponentBaseWithState components to facilitate accessing parameter states.

public static class ComponentBaseWithStateExtensions
Inheritance
ComponentBaseWithStateExtensions
Inherited Members

Methods

GetState<T>(ComponentBaseWithState, string)

Gets the read-only parameter state of a specified property in the component.

public static T? GetState<T>(this ComponentBaseWithState component, string propertyName)

Parameters

component ComponentBaseWithState

The MudBlazor component instance.

propertyName string

The name of the property whose parameter state needs to be accessed. Use nameof(...) to get the property name.

Returns

T

The Value of the specified property.

Type Parameters

T

The type of the parameter.

Exceptions

KeyNotFoundException

Thrown when the parameter state with propertyName is not found.

GetState<TComponent, T>(TComponent, Func<TComponent, T>, string?)

Gets the read-only parameter state of a specified property in the component.

public static T? GetState<TComponent, T>(this TComponent component, Func<TComponent, T> propertyExpression, string? propertyNameCallerArgumentExpression = null) where TComponent : ComponentBaseWithState

Parameters

component TComponent

The MudBlazor component instance.

propertyExpression Func<TComponent, T>

An expression representing the property whose parameter state needs to be accessed.

propertyNameCallerArgumentExpression string

The property name. Do not set this value as it's set at compile-time through CallerArgumentExpressionAttribute.

Returns

T

The Value of the specified property.

Type Parameters

TComponent

The type of the MudBlazor component.

T

The type of the parameter.

Exceptions

ArgumentNullException

Thrown when propertyExpression is null.

ArgumentException

Thrown when propertyExpression is invalid.

KeyNotFoundException

Thrown when the parameter state with propertyExpression is not found.