Show Hexadecimal representation of a file, neat for checking encoding of the file

Post date: Feb 12, 2010 9:49:46 AM

Read bytes from a file, convert the values to hex and display them.

DO NOT USE ON BIG FILES!

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace ConsoleApplication4

{ class Program

{ static void Main(string[] args) { byte[] buffer = File.ReadAllBytes(@"c:\temp\Orginal.txt"); foreach (var item in buffer) { Console.Write("0x{0:X} ", item); Console.ReadKey(); } Console.ReadLine(); } }}