Is it possible to determine what language a .NET assembly was written in?
Is there a method to determine the original language of a .NET assembly if the source code is not avail开发者_高级运维able?
Not really, but you can sometimes make a guess.
For example, if you have a VB.NET assembly containing anonymous types, the compiler-generated name in the assembly will look something like this:
VB$AnonymousType_T<T0, T1>
Anonymous types in a C# assembly look like this:
<>f__AnonymousType0<....>
Different compilers will implement these sorts of things slightly different. C++/CLI assemblies tend to have lots of types in the assembly with "funny" names (for things like functions that belong to the global scope and so on).
Visual Basic applications also reference the Microsoft.VisualBase assembly (though any .NET app can technically reference any assembly, so that's not a 100% indicator).
You can guess by looking at what assemblies it references. If you see one of Microsoft.CSharp
or Microsoft.VisualBasic
, for example, that could give you a big hint.
Not really since they're all roughly compiled to the same IL.
精彩评论