Last Updated: May 22, 2026
C# 11 added a new access modifier, file, that you can put in front of a type declaration. A file type is visible only inside the single source file where it's declared. The feature was designed primarily to make life easier for source generators, but it's also a useful tool for keeping private helpers truly private. Note that this lesson is about the file modifier on types, which is a different feature from the file-scoped namespace syntax.