Create int from hexadecimal literal in CSharp

Description

The following code shows how to create int from hexadecimal literal.

Example


//Hexadecimal digits a (or A) through f (or F) represent values in the range 10 through 15. 
//from  www .  ja  va  2  s .  co m
using System;

public class MainClass{
    public static void Main() {
        int i = 0x3fff;   // Hexadecimal constant
        int j = 0X3FFF;   // Equal to i
        Console.WriteLine(i);
        Console.WriteLine(j);

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var