Skip to content
Taiizor edited this page Mar 1, 2023 · 22 revisions

UrlExtension Class - Skylark.Standard.Helper Namespace

The UrlExtension class in the Skylark.Standard.Extension.Url namespace provides extension methods for URL encoding and decoding.

Code Examples

Below are example usages of all methods in the UrlExtension class:

Encode(string Url = MUUM.Url)

Encodes the specified URL.

Parameters

Name Description
Url The version of the URL to be encoded. The default value is the Skylark.Standard.Manage.Url.UrlManage.Url constant.

Return Value

The encoded URL.

Code Example

string url = "https://www.example.com/search?q=skylark";
string encodedUrl = UrlExtension.Encode(url);
Console.WriteLine(encodedUrl); // Output: "https%3A%2F%2Fwww.example.com%2Fsearch%3Fq%3Dskylark"

EncodeAsync(string Url = MUUM.Url)

Encodes the specified URL asynchronously.

Parameters

Name Description
Url The version of the URL to be encoded. The default value is the Skylark.Standard.Manage.Url.UrlManage.Url constant.

Return Value

The encoded URL.

Code Example

string url = "https://www.example.com/search?q=skylark";
string encodedUrl = await UrlExtension.EncodeAsync(url);
Console.WriteLine(encodedUrl); // Output: "https%3A%2F%2Fwww.example.com%2Fsearch%3Fq%3Dskylark"

Decode(string Url = MUUM.Url)

Decodes the specified URL.

Parameters

Name Description
Url The version of the URL to be decoded. The default value is the Skylark.Standard.Manage.Url.UrlManage.Url constant.

Return Value

The decoded URL.

Code Example

string encodedUrl = "https%3A%2F%2Fwww.example.com%2Fsearch%3Fq%3Dskylark";
string decodedUrl = UrlExtension.Decode(encodedUrl);
Console.WriteLine(decodedUrl); // Output: "https://www.example.com/search?q=skylark"

DecodeAsync(string Url = MUUM.Url)

Decodes the specified URL asynchronously.

Parameters

Name Description
Url The version of the URL to be decoded. The default value is the Skylark.Standard.Manage.Url.UrlManage.Url constant.

Return Value

The decoded URL.

Code Example

string encodedUrl = "https%3A%2F%2Fwww.example.com%2Fsearch%3Fq%3Dskylark";
string decodedUrl = await UrlExtension.DecodeAsync(encodedUrl);
Console.WriteLine(decodedUrl); // Output: "https://www.example.com/search?q=skylark"
Clone this wiki locally