How to access internal class fro
2016-01-01 本文已影响124人
2b75747cf703
internal访问权限经常使用在dll中限制他人代码调用。
比如想使用这个ADB类的功能。
很简单,只要用ildasm反编译,然后把反编译出来的IL代码添加
.custom instance void [mscorlib]System.Runtime.CompilerServices.InternalsVisibleToAttribute::.ctor(string) = (
01 00 16 41 73 73 65 6d 62 6c 79 2d 43 53 68 61
72 70 2d 45 64 69 74 6f 72 00 00
)
//上面的il代码对应的C#代码是 [assembly: InternalsVisibleTo("Assembly-CSharp-Editor")]
然后用ilasm重新编译回去。