This is a question I’ve seen float around several times.  It’s an innocent question that I would think would be easy to find but the continued stream of questions quickly blows that hypothesis.  So, I’ll try to increase the I-Gravity of my post by listing some of the various forms of this question.

 

 

  1. Is there a way to know if a file is a managed assembly?
  2. How can I tell if a given file is managed code?
  3. How do you verify that a DLL is managed?

 

If you’ve got your own version of this question please feel free to leave a comment so that other people asking this question can easily acquire it.

 

Oh, here’s the (managed code) answer:

 

You can easily check for this by calling Assembly.Load() on a particular file.  If that file is a managed assembly this call will succeed.  If it fails you’ll get a System.BadImageFormatException.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I-Gravity:  i-grav-i-ty

 

Pronunciation:  ‘I-gra-v&-tE

Function:  noun

Usage:  often attributive

Etymology:  English

Synonym:  google juice