SYSK 33: New kind of “friend” — assembly:InternalsVisibleTo

An internal type or internal member in an assembly can now be accessed from another assembly.  Yes, you heard right.  There is a new assembly level attribute that allows you to give one assembly access to another assembly's internal types and members – it’s called InternalsVisibleToAttribute attribute.   However, this new attribute is only available in C# (sorry, VB.NET developers).

Here is the usage example:  [assembly:InternalsVisibleTo("MyOtherAssembly")]

Note:  if assembly A gives assembly B access to its internal types and members, and then assembly B, in its turn, gives assembly C access to its members, assembly C does not automatically become a friend of assembly A.

Comments (1)

  1. Hasani says:

    It’s also works for c++ cli/managed c++/ or whatever else it’s called =]

    nice find though.

Skip to main content