Reputation: 5021
By default classes in an assembly (in my case it is DelegatesSampleApplication) are internal. So outside assemblies should not be able to access them right untill and unless they are declared as the friend assemblies for that specific assembly? Now in another program which is definitely a different assembly for me (in my case it is ReflectionSampleApplication) I tried to load that assembly via reflection Assembly.LoadFrom. And I am now able to access the type objects within the so called "Internal" classes of that assembly. Is that an expected behaviour ? Am I missing something ?
Upvotes: 2
Views: 61
Reputation: 273611
And I am now able to access the type objects within the so called "Internal" classes of that assembly. Is that an expected behaviour ?
Yes, that is expected.
Am I missing something ?
Access modifiers are about controlling access in 'normal' compiled code. They were never meant to restrict Reflection. And they are not about security or secrecy in any way, they are there to help organize your code.
Upvotes: 3