I have two class libraries “MyLibrary.dll” and “MyLibraryEditor.dll” for a Unity runtime and editor extension. There are several class members inside “MyLibrary.dll” that are only intended for use by “MyLibraryEditor.dll”.
My first thought was to use the internal keyword because I mistakenly thought that this constrained visibility to a namespace. Instead it is clear that this keyword limits visibility to the assembly.
What is the best way to constrain access to some class members to “MyLibrary.dll” and “MyLibraryEditor.dll” without hurting performance? Also, reflection is not an option.
I am happy to simply not document the functions, but unfortunately Intellisense (and MonoDevelop’s equivalent) show these members.
If you want internals in one assembly to be visible from another assembly, you can use the
InternalsVisibleToattribute on the assembly containing the internals. See http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx:That answered, you might want to rethink your architectural design so that you don’t need to use it, since it will open up all internals to the other assembly, not only the ones that you want.