[HowTo] C# Hex Hendling TuT
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("Hexadecimal -> Decimal Concverter by kInGoFcHaOs for - www.computerforum.de");
Console.WriteLine("Format: 0xA oder A ist erlaubt!!!");
Console.WriteLine("Bitte schreiben sie jetzt den Hexadezimal code in die Console");
string hexa = Console.ReadLine();
string hexacode = hexa;
Int64 Umwandlung = Convert.ToInt32(hexa, 16);
Console.WriteLine("Die umwandlung von " + hexacode + " in Dezimal ist:" + Umwandlung);
Console.ReadLine();
return;
}
catch(Exception err)
{
if (err.Message == "Der Wert für einen UInt64 war zu groß oder zu klein.")
{
Console.WriteLine("Die hex zahl ist zu gross!!");
Console.ReadLine();
return;
}
else
{
Console.WriteLine(err.Message);
Console.ReadLine();
}
}
}
}
}