C# | Uri.IsHexEncoding() Method Last Updated : 30 Apr, 2019 Comments Improve Suggest changes Like Article Like Report Uri.IsHexEncoding(String, Int32) Method is used to check whether a character in a string is hexadecimal encoded or not. This checks for hexadecimal encoding which follows the pattern "%hexhex" in a string, where "hex" is a digit from 0 to 9 or a letter from A-F (case-insensitive). Syntax: public static bool IsHexEncoding (string pattern, int index); Parameters: pattern: It is the string to check. index: It is the location in pattern to check for hexadecimal encoding. Return Value: This method returns a Boolean value that is true if pattern is hexadecimal encoded at the specified location otherwise, false. Below programs illustrate the use of Uri.IsHexEncoding(String, Int32) Method: Example 1: csharp // C# program to demonstrate the // Uri.IsHexEncoding(String, // Int32) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing pattern string pattern = "%75"; // Declaring and initializing index int index = 1; // Validating the Character in the String // using IsHexEncoding(String, Int32) method bool value = Uri.IsHexEncoding(pattern, index); // Displaying the result if (value) Console.WriteLine("{0}({1}) is a valid "+ "Hexadecimal Encoded", pattern); else Console.WriteLine("{0} is a valid"+ " Hexadecimal Encoded", pattern); } } Output: %75 is a valid Hexadecimal Encoded Example 2: csharp // C# program to demonstrate the // Uri.IsHexEncoding(String, // Int32) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method get("%65", 1); get("%75", 0); get("%55", 0); } // defining get() method public static void get(string pattern, int index) { // Validating the Character in the String // using IsHexEncoding(String, Int32) method bool value = Uri.IsHexEncoding(pattern, index); // Displaying the result if (value) Console.WriteLine("{0} is a valid"+ " Hexadecimal Encoded", pattern); else Console.WriteLine("{0} is a not valid"+ " Hexadecimal Encoded", pattern); } } Output: %65 is a not valid Hexadecimal Encoded %75 is a valid Hexadecimal Encoded %55 is a valid Hexadecimal Encoded Reference: https://docs.microsoft.com/en-us/dotnet/api/system.uri.ishexencoding?view=netstandard-2.1 Comment More infoAdvertise with us Next Article C# | Uri.IsHexEncoding() Method R rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp-Uri-Class Similar Reads C# | Uri.IsHexDigit() Method Uri.IsHexDigit(Char) Method is used to determine whether a specified character is a valid hexadecimal digit or not. Hexadecimal digits are the digits 0 to 9 and the letters A-F or a-f. Syntax: public static bool IsHexDigit (char character); Here, it takes the character to validate. Return Value: Thi 2 min read C# | Uri.GetHashCode() Method Uri.GetHashCode() Method is used to get the hash code for the URI. Syntax: public override int GetHashCode (); Return Value: This method returns an Int32 containing the hash value generated for this URI. Below programs illustrate the use of Uri.GetHashCode() Method: Example 1: csharp // C# program t 1 min read C# | Uri.FromHex() Method Uri.FromHex(Char) Method is used to get the decimal value of a hexadecimal digit. Syntax: public static int FromHex (char digit); Here, it takes the hexadecimal digit (0-9, a-f, A-F) to convert. Return Value: This method returns an Int32 value that contains a number from 0 to 15 that corresponds to 2 min read C# | Uri.HexEscape(Char) Method Uri.HexEscape(Char) Method is used to convert a specified character into its hexadecimal equivalent. Syntax: public static string HexEscape (char character); Here, it takes the character to convert to hexadecimal representation. Return Value: This method returns the hexadecimal representation of the 1 min read C# | Uri.IsWellFormedOriginalString() Method Uri.IsWellFormedOriginalString() Method is used to show whether the string used to construct this Uri was well-formed and is not required to be further escaped. Syntax: public bool IsWellFormedOriginalString (); Return Value: This method returns true if the string was well-formed otherwise, false. B 2 min read Like