using System;using System.IO;using System.Diagnostics;
public static void Main()
Stopwatch sw = new Stopwatch();
string sourceFile = @"D:\CMarkusDownloads\grepWin-2.0.0.msi";
byte[] buffer = new byte[4];
fr = new FileStream(sourceFile, FileMode.Open, FileAccess.Read);
bufferLength = fr.Read(buffer, 0, buffer.Length);
if (bufferLength == 4 && buffer[0] == 0x25 && buffer[1] == 0x50 && buffer[2] == 0x44 && buffer[3] == 0x46)
Console.WriteLine(sourceFile + " is a PDF file in " + sw.ElapsedTicks + " ticks.");
Console.WriteLine(sourceFile + " is a not PDF file in " + sw.ElapsedTicks + " ticks.");
Console.WriteLine(ex.Message + " in " + sw.ElapsedTicks+ " ticks.");