Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

VB.Net - modifier


May 13, 2021 vb.net


Table of contents


Modifiers are keywords added by any programming element to emphasize how the programming element will be executed or accessed in the program

For example, access modifiers: Public, Private, Protected, Friend, Protected Friend, etc., indicate the level of access for programming elements, such as variables, constants, enumerals, or classes.

Vb. A list of modifiers available in Net

The following table provides VB.Net list of the most modifiers:

S.N Modifier Describe
1 Ansi Specify that Visual Basic should group all strings to the National Standards Institute (ANSI) value, regardless of the name of the external procedure being declared.
2 Assembly Specify that the properties at the beginning of the source file apply to the entire assembly.
3 Async Indicates that the method or lambda expression it modified is asynchronous. S uch methods are called asynchronous methods. The caller of an asynchronous method can resume its work without waiting for the asynchronous method to complete.
4 Auto During the call of an external procedure, chchetetmodifierpart in the hepter system provides character set information for grouping strings. I t also affects how Visual Basic searches for external procedure names in external files. The Auto modifier specifies that Visual Basic should group strings according to the .NET Framework rules.
5 Byref The specified argument is passed by reference, i.e. the called procedure can change the value of the variable below the argument in the calling code. I t is used in the following contexts:
  • Declaration statement
  • The function statement
  • Sub statement
6 BYVAL When you specify a pass parameter, the calling procedure or property cannot change the value of the variable below the argument in the calling code. I t is used in the following contexts:
  • Declaration statement
  • The function statement
  • The declaration of the operator
  • Property declaration
  • Sub statement
7 Default Identifys the property as the default property of its class, structure, or interface.
8 Friend

Programming elements that specify one or more declarations can be accessed from the assembly that contains their claims, not just the components that declare them.

Friendaccess is usually the preferred level of application programming elements, and Friend is the default access level for interfaces, modules, classes, or structures.

9 In It is used for common interfaces and agents.
10 Iterator The specified function or Get accessor is an iterator. Aniterator performs a custom iteration of the collection.
11 Key Key keywords enable you to specify behavior for properties of anonymous types.
12 Module Specifies that the properties at the beginning of the source file apply to the current assembly module. It is different from the Module statement.
13 MustInherit Specify that a class can only be used as a base class, and that you cannot create an object directly.
14 MustOverride The specified property or procedure is not implemented in this class and must be overridten in the export class before it can be used.
15 Narrowing Represents a conversion operator (CType) that 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.
16 NotInheritable The specified class cannot be used as a base class.
17 NotOverridable Specifies that properties or procedures cannot be overriding in derived classes.
18 Optional Specifies that procedure parameters can be omitted when a program is called.
19 Out For generic type parameters, the Out keyword specifies that the type is co-variable.
20 Overloads Specifies a property or procedure to re-declare one or more existing properties or procedures with the same name.
21 Overridable Specified properties or procedures can be overridden by properties or procedures in derived classes with the same name.
22 Overrides Specifies that a property or procedure overrides the same named property or procedure inherited from the base class.
23 ParamArray

ParamArray allows you to pass any number of parameters to the procedure.

ParamArray parameters are always declared using ByVal.

24 Partial A class or structure declaration is a partial definition of a class or structure.
25 Private Programming elements that specify one or more declarations can only be accessed in their claim context, including from any contained type.
26 Protected A programmatic element that specifies one or more declarations can only be accessed from its own class or derived class.
27 Public There are no access restrictions for programming elements that specify one or more declarations.
28 ReadOnly Specify that variables or properties can be read but not written.
29 Shadows Specifies that declared programmatic elements are redeclared and hidden in the base class by elements of the same name or a set of overloaded elements.
30 Shared Specifies that one or more declared programming elements are associated with a class or structure, not a specific instance of a class or structure.
31 Static Specify that one or more declared local variables will continue to exist and retain their latest values after the process of declaring them is terminated.
32 Unicode Specify that Visual Basic should group all strings into Unicode values, regardless of the name of the external procedure being declared.
33 Widening Represents a conversion operator (CType) that converts a class or structure to a type that holds all possible values of the original class or structure.
34 WithEvents Specifies that one or more declared member variables refer to instances of classes that can raise events.
35 WriteOnly Specifies that properties can be written but not read.