0

I want to check if a file is an Image.So without going to check for extensions.I simply do this

               try
                 {
                    using (Bitmap test = new Bitmap(Bitmap.FromFile(e.FullPath)))
                    {

                    }
                    //do my processing with image 
                    Console.WriteLine(e.FullPath);
                }
                catch (Exception error)
                {

                }

Is this approach correct?Are there any problems associated?

techno
  • 6,100
  • 16
  • 86
  • 192
  • Possible duplicate of [determine if file is an image](http://stackoverflow.com/questions/670546/determine-if-file-is-an-image) – Veverke Jul 10 '16 at 11:48
  • @Veverke Im not asking `How?`.Im asking about the correctness of my approach and the possible problems associated. – techno Jul 10 '16 at 11:49
  • 1
    Well correctness can be opinion based in this case. You have a working solution, so whats wrong with it? If you want a code review you are here at the wrong place. http://codereview.stackexchange.com/ is the place to go – Sir Rufo Jul 10 '16 at 11:55

0 Answers0