Comment

Comment by jonathanlydall

I primarily work in C# and access modifiers allow me to constrain which types or their members on it are accessible to other types or assemblies.

This is particularly useful when authoring libraries as I know that for anything not public, I can refactor to my hearts content (provided the externally observed behaviour is otherwise unchanged).

It’s a bit of a pity that it was only relatively recently that Visual Studio changed the template for new classes to use internal instead of public.

There are lots of public classes in codebases I work on which are probably only public due to the old default and not used externally so could be refactored, but it’s hard to be sure.

Whereas with internal classes I can be sure (unless someone has used reflection, but then that’s their problem).

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton