For almost all members of a class or record, visibility – that is, which portions of your code have access to that member – is defined by the visibility section that the member is declared in.
By default types start with a visibility level of
private after the
record keyword, and if no other level is specified, all members have that visibility.The following keywords and keyword combinations can be used to introduce a new visibility section that all subsequent members will fall into.
|private||Members||Only accessible from other members of this same type|
|unit||Only accessible from within the same file|
|Members||Only accessible from this type, a subclass or within the same file|
|Members||Only accessible from this type, a subclass that is within the same file|
|assembly||Only accessible from within this project|
|Members||Only accessible from this type, a subclass or within the same assembly|
|Members||Only accessible from this type, a subclass that is within the same assembly|
|protected||Members||Only accessible from this type or subclasses|
|public||Accessible from everywhere|
public visibility levels are also available for types themselves.