Opposite operation to Assembly Load(byte[] rawAssembly)

前端 未结 3 889
庸人自扰
庸人自扰 2021-02-14 22:37

I notice that there is a method of System.Reflection.Assembly, which is Assembly Load(byte[] rawAssembly).

I wonder if there is an opposite ope

3条回答
  •  我寻月下人不归
    2021-02-14 23:01

    To convert an assembly from AppDomain to byte[] use:

    var pi = assembly.GetType().GetMethod("GetRawBytes", BindingFlags.Instance | BindingFlags.NonPublic);
    byte[] assemblyBytes = (byte[]) pi.Invoke(assembly, null);
    

提交回复
热议问题