Table of Contents

Class TwDialogParameters

Namespace
TwBlazor.Models
Assembly
TwBlazor.dll

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

int

this[string]

Gets or sets the parameter with the specified name.

public object? this[string parameterName] { get; set; }

Parameters

parameterName string

The name of the component parameter.

Property Value

object

Methods

Add(string, object?)

Adds or replaces a parameter value.

public void Add(string parameterName, object? value)

Parameters

parameterName string

The name of the component parameter.

value object

The value to assign.

GetEnumerator()

public IEnumerator<KeyValuePair<string, object?>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<string, object>>

Get<T>(string)

Gets the value of a parameter, cast to T.

public T? Get<T>(string parameterName)

Parameters

parameterName string

The name of the component parameter.

Returns

T

The parameter value, or default if not present or not assignable to T.

Type Parameters

T

The 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

parameterName string

The name of the component parameter.

value T

The resulting value, if found and assignable.

Returns

bool

true if the parameter was found and assignable to T; otherwise false.

Type Parameters

T

The expected type of the value.