简体   繁体   中英

Permission class in vb.net

creating an assembly named Assembly1. Assembly1 contains a public method. The global cache contains a second assembly named Assembly2. You must ensure that the public method is only called from Assembly2. Which permission class should you use?

It is impossible to say "method can be used only by Assembly2". But, if I understood you correctly and your goal is to prevent calls from any other assembly, except for Assembly1 or Assembly2, I have an answer.

In .NET you can do this using some trick. You can make your public method Friend (can be used only by Assembly1). And then use Friendly Assembly mechanism . After that you will have method that could be called only from Assembly1 or Assembly2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM