Specifies that a declared element associates only with the class or procedure in which it is declared and not with any particular instance of that class.




Declaration context
Shared is only allowed inside Class, Struct, Trait, Function, Method, and Sub.
Combined modifiers
You cannot combine Shared with other modifiers such as Abstract and Override in the same declaration.
You get access to a shared member of a class or structure through its qualified name. That is the name of the class or structure plus a dot (.) plus the name of the member. You can not get access to a shared member through a variable of the class or structure. Thus, it is not necessary to create any instances of the class or structure.
Implicit sharing
Certain declared elements cannot accept a Shared modifier, yet are shared implicitly. These include Const, in all contexts, and any declared elements inside a module or Library.

Applies to