Sisk

Class

UrlBuilder

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

Provides a way to build URLs by adding segments, queries, and other components.

C#
public sealed class UrlBuilder

Inheritance #

object ← UrlBuilder

Inherited Members #

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors #

NameDescription
UrlBuilder()Initializes a new instance of the UrlBuilder class.
UrlBuilder(string)Initializes a new instance of the UrlBuilder class from a URI string.

Properties #

NameDescription
AuthorityGets or sets the authority part of the URL.
FragmentGets or sets the fragment part of the URL.
NormalizeSeparatorsGets or sets a value indicating whether to normalize separators in the URL.
PathSeparatorGets or sets the character used as the path separator.
QueryGets the query parameters as an array of key-value pairs.
SchemeGets or sets the scheme part of the URL.
SegmentsGets the URL segments as an array of strings.
UriGets the constructed URL as a Uri object.
UrlGets the constructed URL as a string.

Methods #

NameDescription
AddQuery(string, string?)Adds a query parameter to the URL.
AddQuery(string, params string?[])Adds a query parameter with multiple values to the URL.
AddQueryIf(string, string?[], bool)Conditionally adds a query parameter with multiple values to the URL.
AddSegment(string?[], bool)Adds one or more segments to the URL path.
AddSegment(params string?[])Adds one or more segments to the URL path.
AddSegment(string?)Adds a single segment to the URL path.
AddSegmentIf(string, bool)Conditionally adds a segment to the URL path.
ClearQuery()Clears all query parameters from the URL.
ClearSegments()Clears all segments from the URL path.
FromCombined(params string[])Creates a new UrlBuilder instance from one or more combined URLs and/or paths.
Pop(int)Removes the last segment(s) from the URL path.
RemoveQuery(string)Removes a query parameter from the URL.
SetAuthority(string)Sets the authority part of the URL.
SetFragment(string?)Sets the fragment part of the URL.
SetPathSeparator(char)Sets the path separator character.
SetQuery(string, params string?[])Sets (removes and adds) a query parameter with multiple values in the URL.
SetQuery(string, string?)Sets (removes and adds) a query parameter with a single value in the URL.
SetQueryIf(bool, string, string?)Conditionally sets (removes and adds) a query parameter with a single value in the URL.
SetQueryIf(bool, string, params string?[])Conditionally sets (removes and adds) a query parameter with multiple values in the URL.
SetScheme(string)Sets the scheme part of the URL.
ToString()
TransformSegments(Func<string, string?>)Applies a transformation function to each URL segment.

Type to search the documentation and the API reference.