The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

# Uri.FromHex Method

.NET Framework 2.0

Returns the decimal value of a hexadecimal digit.

Namespace: System
Assembly: System (in system.dll)

## Syntax

```public static int FromHex (
char digit
)
```
```public static int FromHex (
char digit
)
```
```public static function FromHex (
digit : char
) : int
```

#### Parameters

digit

The hexadecimal digit (0-9, a-f, A-F) to convert.

#### Return Value

A number from 0 to 15 that corresponds to the specified hexadecimal digit.

## Exceptions

Exception typeCondition

ArgumentException

digit is not a valid hexadecimal digit (0-9, a-f, A-F).

## Remarks

The FromHex method converts a character representing a hexadecimal digit (0-9, a-f, A-F) to its decimal value (0 to 15). If digit is not a valid hexadecimal digit, an ArgumentException exception is thrown.

## Example

The following example determines whether a character is a hexadecimal character and, if it is, writes the corresponding decimal value to the console.

```char  testChar = 'e';
if (Uri.IsHexDigit(testChar) == true)
Console.WriteLine("'{0}' is the hexadecimal representation of {1}", testChar, Uri.FromHex(testChar));
else
Console.WriteLine("'{0}' is not a hexadecimal character", testChar);

string returnString = Uri.HexEscape(testChar);
Console.WriteLine("The hexadecimal value of '{0}' is {1}", testChar, returnString);

```

## Platforms

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

## Version Information

#### .NET Framework

Supported in: 2.0, 1.1, 1.0

#### .NET Compact Framework

Supported in: 2.0, 1.0

Uri Class
Uri Members
System Namespace