Have you ever seen design with reasonable usage of protected internal access modifier?

前端 未结 6 804
野的像风
野的像风 2021-02-13 04:01

I haven\'t, but I don\'t say there isn\'t one.

All of the C# developers who read this probably do know what is protected internal and when to use it. My question is simp

6条回答
  •  醉梦人生
    2021-02-13 05:07

    I actually had to use it for the first time in my career today! I have an plugin architecture with baseclases and the plugins are exposed only through a facade class. The only way to restrict so that the plugin is callable only through the faqade is to make it protected internal since the plugins that override it lies in other assemblies while the faqade layer lies in the same as the base class

    I'm a bit worried that the choice will come back to bite me somehow though so I'm tempted to just make things public

提交回复
热议问题