Calling an function inside an internal class from an another executable

前端 未结 2 1324
借酒劲吻你
借酒劲吻你 2021-02-15 18:46

I want to call a function from a .net executable from my own code. I used reflector and saw this:

namespace TheExe.Core
{
    internal static class AssemblyInfo
         


        
2条回答
  •  天涯浪人
    2021-02-15 19:37

    If you need this for testing purposes consider using InternalsVisibleTo attribute. This way you can make your test assembly to be "friend" of main assembly and call internal methods/classes.

    If you don't have control (or can't sign) assemblies - reflection is the way to do it if you have to. Calling internal methods of third party assemblies is good way to get headaches when that assembly changes in any shape of form.

提交回复
热议问题