Click here to Skip to main content
15,891,774 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cannot seem to be able to write a byte[] to a file Pin
leppie20-Jun-08 8:27
leppie20-Jun-08 8:27 
GeneralRe: Cannot seem to be able to write a byte[] to a file Pin
LCI20-Jun-08 8:32
LCI20-Jun-08 8:32 
QuestionHex String into number Pin
aman200620-Jun-08 7:26
aman200620-Jun-08 7:26 
AnswerRe: Hex String into number Pin
snorkie20-Jun-08 7:47
professionalsnorkie20-Jun-08 7:47 
GeneralRe: Hex String into number Pin
aman200620-Jun-08 7:56
aman200620-Jun-08 7:56 
GeneralRe: Hex String into number Pin
snorkie20-Jun-08 8:05
professionalsnorkie20-Jun-08 8:05 
GeneralRe: Hex String into number Pin
leppie20-Jun-08 8:17
leppie20-Jun-08 8:17 
GeneralRe: Hex String into number Pin
snorkie20-Jun-08 8:21
professionalsnorkie20-Jun-08 8:21 
I felt bad about giving a bad answer, so I wrote a whole program to do this. Hope this helps... Sorry I was too lazy to comment the code.

using System;
using System.Collections.Generic;
using System.Text;

namespace ReverseHex
{
    class Program
    {
        static void Main(string[] args)
        {
            string hexValue = Console.ReadLine();

            int finalNumber = 0;
            int multiplyCount = 0;
            for (int x = hexValue.Length - 1; x >= 0; x--)
            {
                int tempAdd = multiplyCount * 15;

                switch (hexValue[x])
                {
                    case '1':
                        finalNumber += tempAdd + 1;
                        break;
                    case '2':
                        finalNumber += tempAdd + 2;
                        break;
                    case '3':
                        finalNumber += tempAdd + 3;
                        break;
                    case '4':
                        finalNumber += tempAdd + 4;
                        break;
                    case '5':
                        finalNumber += tempAdd + 5;
                        break;
                    case '6':
                        finalNumber += tempAdd + 6;
                        break;
                    case '7':
                        finalNumber += tempAdd + 7;
                        break;
                    case '8':
                        finalNumber += tempAdd + 8;
                        break;
                    case '9':
                        finalNumber += tempAdd + 9;
                        break;
                    case 'A':
                    case 'a':
                        finalNumber += tempAdd + 10;
                        break;
                    case 'B':
                    case 'b':
                        finalNumber += tempAdd + 11;
                        break;
                    case 'C':
                    case 'c':
                        finalNumber += tempAdd + 12;
                        break;
                    case 'D':
                    case 'd':
                        finalNumber += tempAdd + 13;
                        break;
                    case 'E':
                    case 'e':
                        finalNumber += tempAdd + 14;
                        break;
                    case 'F':
                    case 'f':
                        finalNumber += tempAdd + 15;
                        break;
                }

                multiplyCount++;
            }

            Console.WriteLine("Int Value:" + finalNumber.ToString());
            
        }
    }
}


Hogan
GeneralRe: Hex String into number Pin
leppie20-Jun-08 8:29
leppie20-Jun-08 8:29 
GeneralRe: Hex String into number Pin
snorkie20-Jun-08 8:40
professionalsnorkie20-Jun-08 8:40 
GeneralRe: Hex String into number Pin
Brady Kelly20-Jun-08 8:57
Brady Kelly20-Jun-08 8:57 
JokeRe: Hex String into number Pin
Spacix One20-Jun-08 9:23
Spacix One20-Jun-08 9:23 
GeneralRe: Hex String into number Pin
aman200620-Jun-08 8:46
aman200620-Jun-08 8:46 
AnswerRe: Hex String into number Pin
leppie20-Jun-08 8:19
leppie20-Jun-08 8:19 
AnswerRe: Hex String into number Pin
Luc Pattyn20-Jun-08 9:13
sitebuilderLuc Pattyn20-Jun-08 9:13 
AnswerRe: Hex String into number Pin
carbon_golem20-Jun-08 9:16
carbon_golem20-Jun-08 9:16 
AnswerRe: Hex String into number [modified] Pin
Spacix One20-Jun-08 10:11
Spacix One20-Jun-08 10:11 
GeneralRe: Hex String into number Pin
Guffa20-Jun-08 12:55
Guffa20-Jun-08 12:55 
GeneralRe: Hex String into number Pin
Spacix One23-Jun-08 3:37
Spacix One23-Jun-08 3:37 
QuestionSending Text to the Active Control in the Active Application Pin
Dirso20-Jun-08 7:21
Dirso20-Jun-08 7:21 
AnswerRe: Sending Text to the Active Control in the Active Application Pin
DaveyM6920-Jun-08 11:25
professionalDaveyM6920-Jun-08 11:25 
GeneralRe: Sending Text to the Active Control in the Active Application Pin
Dirso20-Jun-08 12:48
Dirso20-Jun-08 12:48 
AnswerRe: Sending Text to the Active Control in the Active Application Pin
mav.northwind20-Jun-08 21:43
mav.northwind20-Jun-08 21:43 
QuestionUpdate Manager Pin
spelltwister20-Jun-08 7:01
spelltwister20-Jun-08 7:01 
AnswerRe: Update Manager Pin
leppie20-Jun-08 7:05
leppie20-Jun-08 7:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.