VB.Net - Modifiers


The modifiers are keywords added with any programming element, to give some especial emphasis on how the programming element will behave, or will be accessed in the program
For example, the access modifiers: Public, Private, Protected, Friend, Protected Friend etc., indicates the access level of a programming element like a variable, constant, enumeration or a class.

List of Available Modifiers in VB.Net

The following table provides the complete list of VB.Net modifiers:
S.NModifierDescription
1AnsiSpecifies that Visual Basic should marshal all strings to American National Standards Institute (ANSI) values regardless of the name of the external procedure being declared.
2AssemblySpecifies that an attribute at the beginning of a source file applies to the entire assembly.
3AsyncIndicates that the method or lambda expression that it modifies is asynchronous. Such methods are referred to as async methods. The caller of an async method can resume its work without waiting for the async method to finish..
4AutoThe charsetmodifier part in the Declare statement supplies the character set information for marshaling strings during a call to the external procedure. It also affects how Visual Basic searches the external file for the external procedure name. The Auto modifier specifies that Visual Basic should marshal strings according to .NET Framework rules.
5ByRefSpecifies that an argument is passed by reference, i.e., the called procedure can change the value of a variable underlying the argument in the calling code. It is used under the contexts of:
  • Declare Statement
  • Function Statement
  • Sub Statement
6ByValSpecifies that an argument is passed in such a way that the called procedure or property cannot change the value of a variable underlying the argument in the calling code. It is used under the contexts of:
  • Declare Statement
  • unction Statement
  • Operator Statement
  • Property Statement
  • Sub Statement
7DefaultIdentifies a property as the default property of its class, structure, or interface.
8FriendSpecifies that one or more declared programming elements are accessible from within the assembly that contains their declaration, not only by the component that declares them.
Friend access is often the preferred level for an application's programming elements, and Friend is the default access level of an interface, a module, a class, or a structure.
9InIt is used in generic interfaces and delegates.
10IteratorSpecifies that a function or Get accessor is an iterator. An iteratorperforms a custom iteration over a collection.
11KeyThe Key keyword enables you to specify behavior for properties of anonymous types.
12ModuleSpecifies that an attribute at the beginning of a source file applies to the current assembly module. It is not same as the Module statement.
13MustInheritSpecifies that a class can be used only as a base class and that you cannot create an object directly from it.
14MustOverrideSpecifies that a property or procedure is not implemented in this class and must be overridden in a derived class before it can be used.
15NarrowingIndicates that a conversion operator (CType) converts a class or structure to a type that might not be able to hold some of the possible values of the original class or structure.
16NotInheritableSpecifies that a class cannot be used as a base class.
17NotOverridableSpecifies that a property or procedure cannot be overridden in a derived class.
18OptionalSpecifies that a procedure argument can be omitted when the procedure is called.
19OutFor generic type parameters, the Out keyword specifies that the type is covariant.
20OverloadsSpecifies that a property or procedure redeclares one or more existing properties or procedures with the same name.
21OverridableSpecifies that a property or procedure can be overridden by an identically named property or procedure in a derived class.
22OverridesSpecifies that a property or procedure overrides an identically named property or procedure inherited from a base class.
23ParamArrayParamArray allows you to pass an arbitrary number of arguments to the procedure. A ParamArray parameter is always declared using ByVal.
24PartialIndicates that a class or structure declaration is a partial definition of the class or structure.
25PrivateSpecifies that one or more declared programming elements are accessible only from within their declaration context, including from within any contained types.
26ProtectedSpecifies that one or more declared programming elements are accessible only from within their own class or from a derived class.
27PublicSpecifies that one or more declared programming elements have no access restrictions.
28ReadOnlySpecifies that a variable or property can be read but not written.
29ShadowsSpecifies that a declared programming element redeclares and hides an identically named element, or set of overloaded elements, in a base class.
30SharedSpecifies that one or more declared programming elements are associated with a class or structure at large, and not with a specific instance of the class or structure.
31StaticSpecifies that one or more declared local variables are to continue to exist and retain their latest values after termination of the procedure in which they are declared.
32UnicodeSpecifies that Visual Basic should marshal all strings to Unicode values regardless of the name of the external procedure being declared.
33WideningIndicates that a conversion operator (CType) converts a class or structure to a type that can hold all possible values of the original class or structure.
34WithEventsSpecifies that one or more declared member variables refer to an instance of a class that can raise events.
35WriteOnlySpecifies that a property can be written but not read.

Post a Comment

Previous Post Next Post