Table of Contents

Method SetQueryIf

Namespace
Sisk.Core.Helpers
Assembly
Sisk.Core.dll

SetQueryIf(bool, string, string?)

Conditionally sets (removes and adds) a query parameter with a single value in the URL.

public UrlBuilder SetQueryIf(bool condition, string key, string? value)

Parameters

condition bool

The condition under which the query parameter should be set.

key string

The key of the query parameter.

value string

The value of the query parameter, or null to add an empty value.

Returns

UrlBuilder

The current UrlBuilder instance, with the query parameter set if condition is true.

SetQueryIf(bool, string, params string?[])

Conditionally sets (removes and adds) a query parameter with multiple values in the URL.

public UrlBuilder SetQueryIf(bool condition, string key, params string?[] values)

Parameters

condition bool

The condition under which the query parameter should be set.

key string

The key of the query parameter.

values string[]

The values of the query parameter, or an array containing null values to add empty values.

Returns

UrlBuilder

The current UrlBuilder instance, with the query parameter set if condition is true.