
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Uri.HexEscape(Char) Method in C#
The Uri.HexEscape() method in C# is used to convert a specified character into its hexadecimal equivalent.
Syntax
Following is the syntax −
public static string HexEscape (char ch);
Above, the parameter ch is the character to convert to hexadecimal representation.
Example
Let us now see an example to implement the Uri.HexEscape() method −
using System; public class Demo { public static void Main(){ char ch = 'k'; string res = Uri.HexEscape(ch); Console.WriteLine("Hexadecimal Equivalent = "+res); } }
Output
This will produce the following output −
Hexadecimal Equivalent = %6B
Example
Let us now see another example to implement the Uri.HexEscape() method −
using System; public class Demo { public static void Main(){ char ch = 'P'; string res = Uri.HexEscape(ch); Console.WriteLine("Hexadecimal Equivalent = "+res); } }
Output
This will produce the following output −
Hexadecimal Equivalent = %50
- Related Articles
- Uri.MakeRelativeUri(Uri) Method in C#
- Uri.IsBaseOf(Uri) Method in C#
- Char.ToUpperInvariant(Char) Method in C#
- Char.ToLowerInvariant(Char) Method in C#
- Difference Between URL and URI
- How to get file URI reference in Java?
- Difference between char s[] and char *s in C
- Difference between const char* p, char * const p, and const char * const p in C
- Convert Image to Data URI with JavaScript
- State the differences between URI and URL in Computer Network.
- Char Struct in C#
- How to convert an std::string to const char* or char* in C++?
- How to convert a std::string to const char* or char* in C++?
- Declare char arrays in C#
- CHAR vs VARCHAR in SQL

Advertisements