---
title: "omvandla till heltal?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/141442-omvandla-till-heltal"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "eddy1"
published: "2006-01-24T18:03:49.000Z"
updated: "2006-01-25T07:02:24.000Z"
replies: 3
views: 337
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/141442-omvandla-till-heltal"
---

# omvandla till heltal?

## #1 — eddy1, 2006-01-24T18:03Z

vad blir detta omvandlat till heltal?

0xF021 ?

Mvh

Permalänk: https://www.webforum.nu/p/141442

## #2 — P, 2006-01-24T20:24Z

61473

Gör så här:
1\. Start\>kör\>calc
2\. Välj avancerat under visa.
3\. Välj hex
4\. Skriv in F021, 0x betyder att det är hexadecimalt.
5\. Välj dec igen.

Eller på papper:
0-9 = samma värden i hexadecimal
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Då blir F021 = 15\*16 ^3 + 0\* 16^2+ 2 \* 16^1 + 1 \* 16^0

Permalänk: https://www.webforum.nu/p/1753613

## #3 — eddy1, 2006-01-24T20:26Z

tack

ville se att jag gjorde rätt. Men då är det något annat som strular...

Tack

Permalänk: https://www.webforum.nu/p/1753614

## #4 — Gladh, 2006-01-25T07:02Z

Om man nu vill göra det i kod, så gör man så här:

```
            // Store integer 182
            int decValue = 182;
            // Convert integer 182 as a hex in a string variable
            string hexValue = decValue.ToString("X");
            // Convert the hex string back to the number
            int decAgain = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber);
```

\- M

Permalänk: https://www.webforum.nu/p/1753718

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/141442-omvandla-till-heltal
