First you need to use Windows calculator (use the programmer option) to find 254's hexadecimal representation, which is: FE
It will look like 0xFE in hexadecimal format.
then comes the code:
using System;
class VariableInHexadecimalFormat
{
static void Main()
{
int a = 0xFE;
Console.WriteLine(a);
}
}