Home » C#

C# | Uri.HexEscape() Method with Example

Uri.HexEscape() Method: Here, we are going to learn about the HexEscape() method of Uri class with example in C#.
Submitted by Nidhi, on March 26, 2020

Uri.HexEscape() Method

Uri.HexEscape() method is a static method that is used to get the hexadecimal equivalent of the specified character.

Syntax:

    string Uri.HexEscape(char ch);

Parameter(s):

  • char ch – represents the character to be converted in hexadecimal equivalent.

Return value:

The return type of this method is string, it returns the string value that represent hexadecimal equivalent of specified character.

Exception:

    System.ArgumentOutOfRangeException;

Example to demonstrate example of Uri.HexEscape() method

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        char ch     = 'D';
        string retStr   = "";

        retStr = Uri.HexEscape(ch);
        
        Console.WriteLine("Hexadecimal Equivalent: "+retStr);
    }
}

Output

Hexadecimal Equivalent: %44
Press any key to continue . . .





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.