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
componentComponentBaseWithStateThe MudBlazor component instance.
propertyNamestringThe 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
TThe type of the parameter.
Exceptions
- KeyNotFoundException
Thrown when the parameter state with
propertyNameis 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
componentTComponentThe MudBlazor component instance.
propertyExpressionFunc<TComponent, T>An expression representing the property whose parameter state needs to be accessed.
propertyNameCallerArgumentExpressionstringThe 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
TComponentThe type of the MudBlazor component.
TThe type of the parameter.
Exceptions
- ArgumentNullException
Thrown when
propertyExpressionis null.- ArgumentException
Thrown when
propertyExpressionis invalid.- KeyNotFoundException
Thrown when the parameter state with
propertyExpressionis not found.