Project NameCheck standard configuration: Scopes

Project NameCheck configuration


Project NameCheck scope configuration

The possible scope settings are listed here.

ByRefA procedure parameter passed by reference. This also includes parameters effectively being ByRef even when there is no ByRef keyword. That is default behavior in VB 3-6 for all regular parameters, as well as ParamArrays.
ByValA procedure parameter passed by value. This also includes parameters effectively being ByVal even when there is no ByVal keyword. That is default behavior in VB.NET for all regular parameters, as well as ParamArrays.
Enum constantMember constants defined inside an Enum...End Enum block.
FriendA name with Friend scope.
GlobalA Public name having project-level visibility without qualification. In VB 3-6, Public definitions in a .bas module are global. Further, Public Types and Enums are also global regardless of where they are declared. In VB.NET, Public members of a Module are global given that the Module is not inside a Namespace declaration. See also Public.
LocalA variable or a constant declared inside a procedure.
PrivateA name with Private scope.
ProtectedA name with Protected scope.
Protected FriendA name with Protected Friend scope.
PublicA Public name that is not visible without qualification in the project. Public is the correct scope for Public members of classes, forms, UserControls, property pages, .NET structures, interfaces and namespaces. - How can you tell the difference between Public and Global? A Global name can be used without qualification. A Public name must be qualified with a class name, a namespace name, an object variable or a similar structure. It's not generally available without qualification, even though you may make it available via Inherits or Imports.
StaticVariables declared with the Static keyword inside a procedure.
Type fieldA field in a user-defined type in VB 3-6. In VB.NET, members of a Structure are handled like regular variables.

Implicit scopes

If a name has no explicit scope setting, the implicit (default) scope applies. For example, the Dim statement has a Local, Private or Public scope depending on where it appears in code.

VB.NET nested scopes

If VB.NET you can define a module with a narrow scope and its members with a wider scope. An example is a Friend Class with a Public Sub. In this case, the effective scope of the Sub is Friend.

Project NameCheck always uses the defined scope. In the above example, the scope of the Sub would be Public. In other words, the scope of the container has no effect on the naming of the member.

Prefix or suffix?

You are probably going to set a prefix for most scopes. Suffixes are mostly useful for Enum members ("_enum") and Type elements ("_fld").

You could also suffix a ByRef parameter as "_out" to indicate that the parameter is only used to return a value, "_inout" to indicate it as an input/output parameter and "_in" to indicate an input-only parameter. In this case, you would use "_out,_inout,_in" as the ByRef suffix setting.

Of course, you are free to use any combination you like.

Unchecked scopes

Module names are not subject to the scope settings. The Misc page offers additional options to exclude the certain names from the scope rules.

Project NameCheck configuration

©Aivosto Oy - Project Analyzer Help Contents