Class TwDialogParameters
A bag of component parameters passed to a dialog shown via ITwDialogService.
public class TwDialogParameters : IEnumerable<KeyValuePair<string, object?>>, IEnumerable
- Inheritance
-
TwDialogParameters
- Implements
- Inherited Members
Remarks
Values are applied to the dialog content component as if they were set with the Blazor [Parameter]
attribute, matched by name. Use object initializer syntax, e.g. new TwDialogParameters { ["Message"] = "Hi" }.
Constructors
TwDialogParameters()
public TwDialogParameters()
Properties
Count
Gets the number of parameters in this collection.
public int Count { get; }
Property Value
this[string]
Gets or sets the parameter with the specified name.
public object? this[string parameterName] { get; set; }
Parameters
parameterNamestringThe name of the component parameter.
Property Value
Methods
Add(string, object?)
Adds or replaces a parameter value.
public void Add(string parameterName, object? value)
Parameters
GetEnumerator()
public IEnumerator<KeyValuePair<string, object?>> GetEnumerator()
Returns
Get<T>(string)
Gets the value of a parameter, cast to T.
public T? Get<T>(string parameterName)
Parameters
parameterNamestringThe name of the component parameter.
Returns
- T
The parameter value, or
defaultif not present or not assignable toT.
Type Parameters
TThe expected type of the value.
TryGet<T>(string, out T?)
Attempts to get the value of a parameter, cast to T.
public bool TryGet<T>(string parameterName, out T? value)
Parameters
parameterNamestringThe name of the component parameter.
valueTThe resulting value, if found and assignable.
Returns
- bool
trueif the parameter was found and assignable toT; otherwisefalse.
Type Parameters
TThe expected type of the value.