💾 Paweł Łukasik<p>Keeping everything public might be considered an anti-pattern. On the other hand, if we use more restrictive access modifier, we might encounter situations where something that we would like to access would not be possible. The InternalsVisibleTo attribute might come in handy in such situations.</p><p>Using this attribute, we can specify that the assembly mentioned  in the attribute, will be able to access internal types specified in the one where the attribute is used. This means types that are marked with internal access modifier, internal protected, or private protected ones will be accessible. We could use this to allow access to some internal types for a test project. See the example code 👇.</p><p>Docs 📑:  <a href="https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-runtime-compilerservices-internalsvisibletoattribute" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">learn.microsoft.com/en-us/dotn</span><span class="invisible">et/fundamentals/runtime-libraries/system-runtime-compilerservices-internalsvisibletoattribute</span></a></p><p>Did you know about this attribute? Did you use this one?</p><p><a href="https://infosec.exchange/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://infosec.exchange/tags/internalsvisibleto" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>internalsvisibleto</span></a> <a href="https://infosec.exchange/tags/attribute" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>attribute</span></a><br>---<br>If you find this useful, consider giving a like & share ♻</p>
