Can a C# program find out what language an assembly is written in?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Larry__Weiss

    #1

    Can a C# program find out what language an assembly is written in?

    Can a C# program find out what language an assembly (or components
    thereof) is written in?

    - Larry
  • Jeroen Mostert

    #2
    Re: Can a C# program find out what language an assembly is writtenin?

    Larry__Weiss wrote:
    Can a C# program find out what language an assembly (or components
    thereof) is written in?
    >
    All assemblies are written in IL.

    Or to put it differently, it's impossible to do this with any sort of
    reliability. You can guess at it heuristically: for example, all assemblies
    compiled with the C# compiler will have a private "<Module>" class; those
    compiled with the VB.NET compiler will not (they have other telltale signs,
    like having a class with a StandardModuleA ttribute). However, drawing
    conclusions from this is dubious at best, and it would be hitting a moving
    target.

    --
    J.

    Comment

    • Larry__Weiss

      #3
      Re: Can a C# program find out what language an assembly is writtenin?

      Jeroen Mostert wrote:
      Larry__Weiss wrote:
      >Can a C# program find out what language an assembly (or components
      >thereof) is written in?
      >>
      All assemblies are written in IL.
      >
      Or to put it differently, it's impossible to do this with any sort of
      reliability. You can guess at it heuristically: for example, all
      assemblies compiled with the C# compiler will have a private "<Module>"
      class; those compiled with the VB.NET compiler will not (they have other
      telltale signs, like having a class with a StandardModuleA ttribute).
      However, drawing conclusions from this is dubious at best, and it would
      be hitting a moving target.
      >
      To dig a little deeper, why are there currently those telltale heuristic
      differences? Do they indicate any basic differences in what can be
      implemented in C# compared to what can be implemented with VB.NET ?

      - Larry

      Comment

      • Family Tree Mike

        #4
        Re: Can a C# program find out what language an assembly is written in?

        Look at "Reflector" by searching the net. It can dissassemble an exe or dll
        to VB, C#, C++, Delphi, Chrome, or show the IL. It isn't directly related
        to your question, but, this tool doesn't try and tell me what the language
        used for an assembly originally was.

        "Larry__Wei ss" <lfw@airmail.ne twrote in message
        news:eaDGHZBHJH A.3140@TK2MSFTN GP06.phx.gbl...
        Can a C# program find out what language an assembly (or components
        thereof) is written in?
        >
        - Larry

        Comment

        • Tom Dacon

          #5
          Re: Can a C# program find out what language an assembly is written in?

          "Larry__Wei ss" <lfw@airmail.ne twrote in message
          news:uzdIIbCHJH A.3504@TK2MSFTN GP02.phx.gbl...
          To dig a little deeper, why are there currently those telltale heuristic
          differences? Do they indicate any basic differences in what can be
          implemented in C# compared to what can be implemented with VB.NET ?
          More than anything, the differences simply reflect (no pun intended) the
          design choices made by the programmer teams that implemented the languages.

          This also applies to certain syntax differences between, say, C# and VB as
          the two most well-known languages hosted on top of IL. The designers of VB
          gave their users certain kinds of "syntactica l sugar" that the C# designers
          didn't think of or perhaps didn't think would be useful or worth the
          trouble. The C# team, on their side, did the same thing with features that
          VB doesn't happen to have (the 'using' statement springs to mind).

          Neither of these sets of differences represent limitations of what the
          languages could in principle be made to do. IL has quite a bit more
          capability than has been exposed in either language.

          Tom Dacon
          Dacon Software Consulting


          Comment

          • Mark Rae [MVP]

            #6
            Re: Can a C# program find out what language an assembly is written in?

            "Tom Dacon" <tdacon@communi ty.nospamwrote in message
            news:%23tAaUUDH JHA.3504@TK2MSF TNGP02.phx.gbl. ..
            The C# team, on their side, did the same thing with features that VB
            doesn't happen to have (the 'using' statement springs to mind).
            VB.NET has had a "Using" statement since v2.


            --
            Mark Rae
            ASP.NET MVP


            Comment

            Working...