UrlSearchParams Class
https://url.spec.whatwg.org/#interface-urlsearchparams
public sealed class UrlSearchParams : IEnumerable<KeyValuePair<string, string>>, IEnumerableConstructors
| Name | Description |
|---|---|
| UrlSearchParams() | Creates an empty list of name-value pairs. |
| UrlSearchParams(IEnumerable<IReadOnlyList<string>>) | Initializes the object from a sequence of name-value pairs (each inner sequence must have exactly two items). |
| UrlSearchParams(IEnumerable<KeyValuePair<string, string>>) | Initializes the object from a record. |
| UrlSearchParams(string) | Creates a list of name-value pairs by parsing the given query string, ignoring a leading ?. |
UrlSearchParams overloads
UrlSearchParams()
UrlSearchParams.csCreates an empty list of name-value pairs.
public UrlSearchParams()UrlSearchParams(IEnumerable<IReadOnlyList<string>>)
UrlSearchParams.csInitializes the object from a sequence of name-value pairs (each inner sequence must have exactly two items).
public UrlSearchParams(IEnumerable<IReadOnlyList<string>> init)UrlSearchParams(IEnumerable<KeyValuePair<string, string>>)
UrlSearchParams.csInitializes the object from a record.
public UrlSearchParams(IEnumerable<KeyValuePair<string, string>> init)UrlSearchParams(string)
UrlSearchParams.csCreates a list of name-value pairs by parsing the given query string, ignoring a leading ?.
public UrlSearchParams(string init)Properties
| Name | Description |
|---|---|
| Size | Gets the number of name-value pairs. |
Gets the number of name-value pairs.
public uint Size { get; }Methods
| Name | Description |
|---|---|
| Append(string, string) | Appends a name-value pair. |
| Delete(string, string?) | Removes the pairs with the given name, and the given value if specified. |
| Get(string) | Returns the value of the first pair with the given name, or null when there is none. |
| GetAll(string) | Returns the values of all the pairs with the given name. |
| GetEnumerator() | Returns an enumerator over the name-value pairs. |
| Has(string, string?) | Returns whether a pair with the given name, and the given value if specified, exists. |
| Set(string, string) | Sets the value of the first pair with the given name and removes the other ones, or appends a pair when there is none. |
| Sort() | Sorts the name-value pairs by name, comparing code units (stable sort). |
| System.Collections.IEnumerable.GetEnumerator() | |
| ToString() | Stringification behavior: https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior |
Append(string, string)
UrlSearchParams.csDelete(string, string?)
UrlSearchParams.csGet(string)
UrlSearchParams.csReturns the value of the first pair with the given name, or null when there is none.
GetAll(string)
UrlSearchParams.csReturns the values of all the pairs with the given name.
public IReadOnlyList<string> GetAll(string name)GetEnumerator()
UrlSearchParams.csReturns an enumerator over the name-value pairs.
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()Has(string, string?)
UrlSearchParams.csSet(string, string)
UrlSearchParams.csSort()
UrlSearchParams.csSorts the name-value pairs by name, comparing code units (stable sort).
public void Sort()