Handle the file extention using the Path class

take a look http://dotnetuniver.blogspot.com/