visual basic .net (vb.net) is an object- oriented computer ... · dot net technologies unit – i...
TRANSCRIPT
SRI CHANDRASEKHARENDRA SARASWATHI VISWA MAHAVIDYALAYA
SCSVMV Deemed to be UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Faculty: S.Gokulakrishnan AP/CSE
Dot Net Technologies
Unit – I
Visual Basic .NET (VB.NET) is an object-
oriented computer programming language
implemented on the .NET Framework.
it is an evolut ion of classic Visual Basic
language
Like all other .NET languages, VB.NET has
complete support for object-oriented
concepts.
Everything in VB.NET is an object, including
all of the primit ive types (Short, Integer,
Long, String, Boolean, etc.) and user-defined
types, events, and even assemblies. All
objects inherits from the base class Object.
VB.NET is implemented by Microsoft's .NET
framework. Therefore, it has full access to all
the libraries in the .Net Framework.
It's also possible to run VB.NET programs on
Mono, the open-source alternat ive to .NET,
not only under Windows, but even Linux or
Mac OSX.
Mono is an open-source version of the .NET
Framework which includes a Visual Basic
compiler and runs on several operat ing
systems, including various flavors of Linux
and Mac OS.
The stated purpose of Mono is not only to be
able to run Microsoft .NET applicat ions
cross-platform, but also to bring better
development tools to Linux developers.
Mono can be run on many operat ing
systems including Android, BSD, iOS, Linux,
OS X, Windows, Solaris and UNIX.
The following reasons make VB.Net a widely used
professional language
Modern, general purpose.
Object oriented.
Component oriented.
Easy to learn.
Structured language.
It produces eff icient programs.
It can be compiled on a variety of computer
platforms.
Part of .Net Framework.
Strong Programming Features VB.Net
Boolean Condit ions
Automatic Garbage Collect ion
Standard Library
Assembly Versioning
Propert ies and Events
Delegates and Events Management
Easy-to-use Generics
Indexers
Condit ional Compilat ion
Simple Mult ithreading
Microsoft provides the following development
tools for VB.Net programming −
Visual Studio (VS)
Visual Basic Express (VBE)
Visual Web Developer
The last two are free. Using these tools, you
can write all kinds of VB.Net programs from
simple command-line applicat ions to more
complex applicat ions.
What is Microsoft .Net Framework?The .Net framework is a software development platformdeveloped by Microsoft. The framework was meant tocreate applications, which would run on the WindowsPlatform. The first version of the .Net framework wasreleased in the year 2002.
The version was called .Net framework 1.0. The .Netframework has come a long way since then, and thecurrent version is 4.7.1.
The .Net framework can be used to create both - Form-based and Web-based applications. Web services canalso be developed using the .Net framework.
The framework also supports various programminglanguages such as Visual Basic and C#. So developerscan choose and select the language to develop therequired application
Identif iers
An identif ier is a name used to identify a class, variable,
funct ion, or any other user-defined item.
A name must begin with a letter that could be followed
by a sequence of letters, digits (0 - 9) or underscore.
The f irst character in an identif ier cannot be a digit.
It must not contain any embedded space or symbol like
? - +! @ # % ^ & * ( ) [ ] { } . ; : " ' / and \. However, an
underscore ( _ ) can be used.
It should not be a reserved keyword.
VB.Net Keywords
Variable Declaration in VB.Net
The Dim statement is used for variable declaration and storage allocation
for one or more variables. The Dim statement is used at module, class,
structure, procedure or block level.
Dim StudentID As Integer
Dim StudentName As String
Dim Salary As Double
Dim count1, count2 As Integer
Dim status As Boolean
Dim exitButton As New System.Windows.Forms.Button
Dim lastTime, nextTime As Date
Dim a As Short Dim b As Integer
Dim c As Double
a = 10
b = 20
c = a + b
The constants refer to fixed values that the program may not alter during
its execution. These fixed values are also called literals.
Constants can be of any of the basic data types like an integer constant, a
floating constant, a character constant, or a string literal. There are also
enumeration constants as well.
Const maxval As Long = 4999
Const PI = 3.14149
A statement is a complete instruction in Visual Basic programs. It may
contain keywords, operators, variables, literal values, constants and
expressions.
Statements could be categorized as −
Declaration statements − these are the statements where you name a
variable, constant, or procedure, and can also specify a data type.
Executable statements − these are the statements, which initiate
actions. These statements can call a method or function, loop or
branch through blocks of code or assign values or expression to a
variable or constant. In the last case, it is called an Assignment
statement.
An operator is a symbol that tells the compiler to perform specific
mathematical or logical manipulations. VB.Net is rich in built-in operators
and provides following types of commonly used operators −
Arithmetic Operators
Comparison Operators
Logical/Bitwise Operators
Bit Shift Operators
Assignment Operators
Miscellaneous Operators
Security concepts
You can implement the security model in your applications in a declarative
and/or an imperative way. In most cases, you should prefer declarative
security, and implement the security model only when some application
security issues can be known only at runtime.
.NET Framework Security Model
Code Access Security (CAS)
Permissions
Code groups
CLR examines all code groups in the hierarchy. When the code group is
marked as Exclusive, then the CLR stops checking for group membership.
Next, the CLR determines the permission sets for each code group. If the
code is a member of the code group that is marked as Exclusive, only the
permission set of that code group is taken into account, otherwise the CLR
calculates the permission as a Union of all permission sets of all code
groups that the running code is a member of.
Computing Permissions
Any code group can have a LevelFinal property;
What is BCL/ CL in .Net?
.NET Framework Class Library is the collection of classes, namespaces,
interfaces and value types that are used for .NET applications.
It contains thousands of classes that supports the following functions.
o Base and user-defined data types
o Support for exceptions handling
o input/output and stream operations
o Communications with the underlying system
o Access to data
o Ability to create Windows-based GUI applications
o Ability to create web-client and server applications
o Support for creating web services
BCL stands for Base class library also known as Class library (CL). BCL is
a subset of Framework class library (FCL). Class library is the collection of
reusable types that are closely integrated with CLR. Base Class library
provides classes and types that are helpful in performing day to day
operation e.g. dealing with string and primitive types, database connection,
IO operations.
Namespace included in Base Class library are as following
Namespace Description
System Provides primitive data types, console,
array etc.
System.Collections Provide classes to work with collection
e.g. List, stack, queue, dictionary
System.Configuration Used for reading and writing program
configuration data
System.Data Provide classes to work with Data,
ADO.Net
System.Diagnostics Provides tracing, logging, performance
counters, etc. functionality
System.Drawing Provide classes to work with graphics
System.Globalization Provide classes to support globalization
System.IO Provides classes to work file files, IO
stream.
System.Linq Interface to LINQ providers and the
execution of LINQ queries
System.Net Provide classes to work with network
protocol e.g. SMTP, TCP
System.Resources Provide classes to work with multilingual
resources.
System.Security provide classes to work with encryption,
hashing etc.
System.Text Provide classes for text encoding,
dealing with regular expression
System.Threading Contains methods to manage the
creation, synchronization and pooling of
program threads
System.Web Classes to work with web application like
ASP.Net, Web services and MVC
System.Xml Provide classes to work with XML type
Common Language Runtime (CLR)
The most important part of the .NET Framework is the .Net Common
Language Runtime (CLR) also called .Net Runtime in short. It is a
framework layer that resides above the Operating System and
handles/manages the execution of the .NET applications. Our .Net programs
don't directly communicate with the Operating System but through CLR.
MSIL (Microsoft Intermediate Language) Code
When we compile our .Net Program using any .Net compliant language like
(C#, VB.NET, C++.NET) it does not get converted into the executable
binary code but to an intermediate code, called MSIL or IL in short,
understandable by CLR. MSIL is an OS and H/w independent code. When
the program needs to be executed, this MSIL or intermediate code is
converted to binary executable code, called native code. The presence of
IL makes it possible the Cross Language Relationship as all the .Net
compliant languages produce the similar standard IL code.
Just In Time Compilers (JITers)
When our IL compiled code needs to be executed, CLR invokes JIT
compilers which compile the IL code to native executable code (.exe or .dll)
for the specific machine and OS. JITers in many ways are different from
traditional compilers as they, as their name suggests, compile the IL to
native code only when desired e.g., when a function is called, IL of
function's body is converted to native code; just in time of need. So, the
part of code that is not used by particular run is not converted to native
code. If some IL code is converted to native code then the next time when
its needed to be used, the CLR uses the same copy without re-compiling.
So, if a program runs for sometime, then it won't have any just in time
performance penalty. As JITers are aware of processor and OS exactly at
runtime, they can optimize the code extremely efficiently resulting in very
robust applications. Also, since JITer knows the exact current state of
executable code, they can also optimize the code by in-lining small function
calls (like replacing body of small function when its called in a loop, saving
the function call time). Although, Microsoft stated that C# and .Net are not
competing with languages like C++ in efficiency, speed of execution,
JITers can make your code even faster than C++ code in some cases when
program is run over extended period of time (like web-servers).
Framework Class Library (FCL)
.NET Framework provides huge set of Framework (or Base) Class Library
(FCL) for common, usual tasks. FCL contains thousands of classes to
provide the access to Windows API and common functions like String
Manipulation, Common Data Structures, IO, Streams, Threads, Security,
Network Programming, Windows Programming, Web Programming, Data
Access, etc. It is simply the largest standard library ever shipped with any
development environment or programming language. The best part of this
library is they follow extremely efficient OO design (design patterns)
making their access and use very simple and predictable. You can use the
classes in FCL in your program just as you use any other class and can
even apply inheritance and polymorphism on these.
Common Language Specification (CLS)
Earlier we used the term '.NET Compliant Language' and stated that all the
.NET compliant languages can make use of CLR and FCL. But what makes a
language '.NET compliant language'? The answer is Common Language
Specification (CLS). Microsoft has released a small set of specification that
each language should meet to qualify as a .NET Compliant Language. As IL
is a very rich language, it is not necessary for a language to implement all
the IL functionality, rather it meets the small subset of it, CLS, to qualify as
a .NET compliant language, which is the reason why so many languages
(procedural and OO) are now running under .Net umbrella. CLS basically
addresses to language design issues and lays certain standards like there
should be no global function declaration, no pointers, no multiple
inheritance and things like that. The important point to note here is that if
you keep your code within CLS boundary, your code is guaranteed to be
usable in any other .Net language.
Common Type System (CTS)
.NET also defines a Common Type System (CTS). Like CLS, CTS is also a
set of standards. CTS defines the basic data types that IL understands.
Each .NET compliant language should map its data types to these standard
data types. This makes it possible for the 2 languages to communicate with
each other by passing/receiving parameters to/from each other. For
example, CTS defines a type Int32, an integral data type of 32 bits (4
bytes) which is mapped by C# through int and VB.Net through its Integer
data type.
Garbage Collector (GC)
CLR also contains Garbage Collector (GC) which runs in a low-priority
thread and checks for un-referenced dynamically allocated memory space.
If it finds some data that is no more referenced by any variable/reference,
it re-claims it and returns the occupied memory back to the Operating
System; so that it can be used by other programs as necessary. The
presence of standard Garbage Collector frees the programmer from
keeping track of dangling data.
Data Types Available in VB.Net
VB.Net provides a wide range of data types. The following table shows all
the data types available −
Data Type Storage Allocation Value Range
Boolean Depends on
implementing
platform
True or False
Byte 1 byte 0 through 255 (unsigned)
Char 2 bytes 0 through 65535 (unsigned)
Date 8 bytes 0:00:00 (midnight) on January
1, 0001 through 11:59:59 PM
on December 31, 9999
Decimal 16 bytes 0 through +/-
79,228,162,514,264,337,593,5
43,950,335 (+/-7.9...E+28)
with no decimal point; 0
through +/-
7.92281625142643375935439
50335 with 28 places to the
right of the decimal
Double 8 bytes -1.79769313486231570E+308
through -
4.94065645841246544E-324,
for negative values
4.94065645841246544E-324
through
1.79769313486231570E+308,
for positive values
Integer 4 bytes -2,147,483,648 through
2,147,483,647 (signed)
Long 8 bytes -9,223,372,036,854,775,808
through
9,223,372,036,854,775,807(sig
ned)
Object 4 bytes on 32-bit
platform
8 bytes on 64-bit
platform
Any type can be stored in a
variable of type Object
SByte 1 byte -128 through 127 (signed)
Short 2 bytes -32,768 through 32,767
(signed)
Single 4 bytes -3.4028235E+38 through -
1.401298E-45 for negative
values;
1.401298E-45 through
3.4028235E+38 for positive
values
String Depends on
implementing
platform
0 to approximately 2 billion
Unicode characters
UInteger 4 bytes 0 through 4,294,967,295
(unsigned)
ULong 8 bytes 0 through
18,446,744,073,709,551,615
(unsigned)
User-Defined Depends on
implementing
platform
Each member of the structure
has a range determined by its
data type and independent of
the ranges of the other
members
UShort 2 bytes 0 through 65,535 (unsigned)
The basic value types provided in VB.Net can be categorized as −
Type Example
Integral types SByte, Byte, Short, UShort,
Integer, UInteger, Long, ULong
and Char
Floating point types Single and Double
Decimal types Decimal
Boolean types True or False values, as
assigned
Date types Date
Introduction to Microsoft Visual Studio
Visual Studio is a complete set of development tools for building high
performance Desktop applications, XML Web Services, mobile applications
and ASP web applications.
Visual Studio provides some ready-made tools for building .NET
applications, such as:
1. Forms designer 2. Server Explorer 3. Property Window 4. Tool-Box 5.
Solution Explorer 6. Compiler 7. Debuggers 8. Output Window
The .NET Framework is multi-lingual, in other words it supports many
types of languages. It supports more than 25 languages. Some of the
languages are:
1. VC++
2. VB
3. C#
4. Jscript
5. XML
6. COBOL
7. Eiffel
8. Smalltalk
9. Python
10. Perl
11. VB Script and so on.
The .NET framework provides a multi-platform environment. It in other
words we need to create:
1. Web-Based
2. Windows-based
3. Console-Based
4. Web-Services
5. Pocket PC
6. Gamming
7. Mobile Applications can be created on .NET platforms.
The 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., indicate 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 −
Sr.No Modifier Description
1 Ansi Specifies that Visual Basic should marshal all
strings to American National Standards Institute
(ANSI) values regardless of the name of the
external procedure being declared.
2 Assembly Specifies that an attribute at the beginning of a
source file applies to the entire assembly.
3 Async Indicates 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.
4 Auto The 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.
5 ByRef Specifies 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
6 ByVal Specifies 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
Function Statement
Operator Statement
Property Statement
Sub Statement
7 Default Identifies a property as the default property of
its class, structure, or interface.
8 Friend Specifies 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.
9 In It is used in generic interfaces and delegates.
10 Iterator Specifies that a function or Get accessor is an
iterator. An iterator performs a custom iteration
over a collection.
11 Key The Key keyword enables you to specify
behavior for properties of anonymous types.
12 Module Specifies that an attribute at the beginning of a
source file applies to the current assembly
module. It is not same as the Module statement.
13 MustInherit Specifies that a class can be used only as a base
class and that you cannot create an object
directly from it.
14 MustOverride Specifies that a property or procedure is not
implemented in this class and must be overridden
in a derived class before it can be used.
15 Narrowing Indicates 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.
16 NotInheritable Specifies that a class cannot be used as a base
class.
17 NotOverridable Specifies that a property or procedure cannot be
overridden in a derived class.
18 Optional Specifies that a procedure argument can be
omitted when the procedure is called.
19 Out For generic type parameters, the Out keyword
specifies that the type is covariant.
20 Overloads Specifies that a property or procedure
redeclares one or more existing properties or
procedures with the same name.
21 Overridable Specifies that a property or procedure can be
overridden by an identically named property or
procedure in a derived class.
22 Overrides Specifies that a property or procedure overrides
an identically named property or procedure
inherited from a base class.
23 ParamArray ParamArray allows you to pass an arbitrary
number of arguments to the procedure. A
ParamArray parameter is always declared using
ByVal.
24 Partial Indicates that a class or structure declaration is
a partial definition of the class or structure.
25 Private Specifies that one or more declared
programming elements are accessible only from
within their declaration context, including from
within any contained types.
26 Protected Specifies that one or more declared
programming elements are accessible only from
within their own class or from a derived class.
27 Public Specifies that one or more declared
programming elements have no access
restrictions.
28 ReadOnly Specifies that a variable or property can be read
but not written.
29 Shadows Specifies that a declared programming element
redeclares and hides an identically named
element, or set of overloaded elements, in a base
class.
30 Shared Specifies 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.
31 Static Specifies 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.
32 Unicode Specifies that Visual Basic should marshal all
strings to Unicode values regardless of the name
of the external procedure being declared.
33 Widening Indicates 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.
34 WithEvents Specifies that one or more declared member
variables refer to an instance of a class that can
raise events.
35 WriteOnly Specifies that a property can be written but not
read.
The Type Conversion Functions in VB.Net
VB.Net provides the following in-line type conversion functions −
Sr.No. Functions & Description
1 CBool(expression) Converts the expression to Boolean data type.
2 CByte(expression) Converts the expression to Byte data type.
3 CChar(expression) Converts the expression to Char data type.
4 CDate(expression) Converts the expression to Date data type
5 CDbl(expression) Converts the expression to Double data type.
6 CDec(expression) Converts the expression to Decimal data type.
7 CInt(expression) Converts the expression to Integer data type.
8 CLng(expression) Converts the expression to Long data type.
9 CObj(expression) Converts the expression to Object type.
10 CSByte(expression) Converts the expression to SByte data type.
11 CShort(expression) Converts the expression to Short data type.
12 CSng(expression) Converts the expression to Single data type.
13 CStr(expression) Converts the expression to String data type.
14 CUInt(expression) Converts the expression to UInt data type.
15 CULng(expression) Converts the expression to ULng data type.
VB.Net - Arrays
An array stores a fixed-size sequential collection of elements of the same
type. An array is used to store a collection of data, but it is often more
useful to think of an array as a collection of variables of the same type.
All arrays consist of contiguous memory locations. The lowest address
corresponds to the first element and the highest address to the last
element.
Creating Arrays in VB.Net
To declare an array in VB.Net, you use the Dim statement. For example,
Dim intData(30) ' an array of 31 elements
Dim strData(20) As String ' an array of 21 strings
Dim twoDarray(10, 20) As Integer 'a two dimensional array of integers
Dim ranges(10, 100) 'a two dimensional array
You can also initialize the array elements while declaring the array. For
example,
Dim intData() As Integer = {12, 16, 20, 24, 28, 32}
Dim names() As String = {"Karthik", "Sandhya", _
"Shivangi", "Ashwitha", "Somnath"}
Dim miscData() As Object = {"Hello World", 12d, 16ui, "A"c}
Dynamic Arrays
Dynamic arrays are arrays that can be dimensioned and re-dimensioned as
par the need of the program. You can declare a dynamic array using
the ReDim statement.
Syntax for ReDim statement −
ReDim [Preserve] arrayname(subscripts)
Where,
The Preserve keyword helps to preserve the data in an existing array,
when you resize it.
arrayname is the name of the array to re-dimension.
subscripts specifies the new dimension.
Multi-Dimensional Arrays
VB.Net allows multidimensional arrays. Multidimensional arrays are also
called rectangular arrays.
Jagged Array
A Jagged array is an array of arrays.
The Array Class
The Array class is the base class for all the arrays in VB.Net. It is defined
in the System namespace. The Array class provides various properties and
methods to work with arrays.
Control Structures in VB.Net
VB.Net provides the following types of decision making statements.
Statement Description
If ... Then statement An If...Then statement consists of a boolean
expression followed by one or more
statements.
If...Then...Else statement An If...Then statement can be followed by an
optional Else statement, which executes when
the boolean expression is false.
nested If statements You can use one If or Else if statement inside
another If or Else if statement(s).
Select Case statement A Select Case statement allows a variable to
be tested for equality against a list of values.
nested Select Case statements You can use one select case statement inside
another select case statement(s).
VB.Net provides following types of loops to handle looping requirements.
Loop Type Description
Do Loop It repeats the enclosed block of statements while
a Boolean condition is True or until the condition
becomes True. It could be terminated at any time
with the Exit Do statement.
For...Next It repeats a group of statements a specified
number of times and a loop index counts the
number of loop iterations as the loop executes.
For Each...Next It repeats a group of statements for each element
in a collection. This loop is used for accessing and
manipulating all elements in an array or a VB.Net
collection.
While... End While It executes a series of statements as long as a
given condition is True.
With... End With It is not exactly a looping construct. It executes a
series of statements that repeatedly refer to a
single object or structure.
Nested loops You can use one or more loops inside any another
While, For or Do loop.
VB.Net provides the following control statements.
Control Statement Description
Exit statement Terminates the loop or select case statement and
transfers execution to the statement immediately
following the loop or select case.
Continue statement Causes the loop to skip the remainder of its body
and immediately retest its condition prior to
reiterating.
GoTo statement Transfers control to the labeled statement.
Though it is not advised to use GoTo statement in
your program.
VB.NET Functions
A procedure is a group of statements that together perform a task when
called. After the procedure is executed, the control returns to the
statement calling the procedure. VB.Net has two types of procedures −
Functions
Sub procedures or Subs
Functions return a value, whereas Subs do not return a value.
Defining a Function
The Function statement is used to declare the name, parameter and the
body of a function. The syntax for the Function statement is −
[Modifiers] Function FunctionName [(ParameterList)] As ReturnType
[Statements]
End Function
Where,
Modifiers − specify the access level of the function; possible values
are: Public, Private, Protected, Friend, Protected Friend and
information regarding overloading, overriding, sharing, and shadowing.
FunctionName − indicates the name of the function
ParameterList − specifies the list of the parameters
ReturnType − specifies the data type of the variable the function
returns
Example
Following code snippet shows a function FindMax that takes two integer
values and returns the larger of the two.
Function FindMax(ByVal num1 As Integer, ByVal num2 As Integer) As
Integer
' local variable declaration */
Dim result As Integer
If (num1 > num2) Then
result = num1
Else
result = num2
End If
FindMax = result
End Function
Function Returning a Value
In VB.Net, a function can return a value to the calling code in two ways −
By using the return statement
By assigning the value to the function name
Defining a Function
The Function statement is used to declare the name, parameter and the
body of a function. The syntax for the Function statement is −
[Modifiers] Function FunctionName [(ParameterList)] As ReturnType
[Statements]
End Function
Where,
Modifiers − specify the access level of the function; possible values
are: Public, Private, Protected, Friend, Protected Friend and
information regarding overloading, overriding, sharing, and shadowing.
FunctionName − indicates the name of the function
ParameterList − specifies the list of the parameters
ReturnType − specifies the data type of the variable the function
returns
Example
Following code snippet shows a function FindMax that takes two integer
values and returns the larger of the two.
Function FindMax(ByVal num1 As Integer, ByVal num2 As Integer) As
Integer
' local variable declaration */
Dim result As Integer
If (num1 > num2) Then
result = num1
Else
result = num2
End If
FindMax = result
End Function
Function Returning a Value
In VB.Net, a function can return a value to the calling code in two ways −
By using the return statement
By assigning the value to the function name
Passing Parameters by Value
In VB.Net, you declare the reference parameters using the ByVal keyword.
Passing Parameters by Reference
In VB.Net, you declare the reference parameters using the ByRef keyword.
What is a .Net Assembly?
The .NET assembly is the standard for components developed with the
Microsoft.NET. Dot NET assemblies may or may not be executable, i.e.,
they might exist as the executable (.exe) file or dynamic link library (DLL)
file. All the .NET assemblies contain the definition of types, versioning
information for the type, meta-data, and manifest. The designers of .NET
have worked a lot on the component (assembly) resolution.
There are two kind of assemblies in .NET;
1. private
2. shared
Private assemblies are simple and copied with each calling assemblies in
the calling assemblies folder.
Shared assemblies (also called strong named assemblies) are copied to a
single location (usually the Global assembly cache). For all calling
assemblies within the same application, the same copy of the shared
assembly is used from its original location. Hence, shared assemblies are
not copied in the private folders of each calling assembly. Each shared
assembly has a four part name including its face name, version, public key
token and culture information. The public key token and version information
makes it almost impossible for two different assemblies with the same
name or for two similar assemblies with different version to mix with each
other.
An assembly can be a single file or it may consist of the multiple files. In
case of multi-file, there is one master module containing the manifest while
other assemblies exist as non-manifest modules. A module in .NET is a sub
part of a multi-file .NET assembly. Assembly is one of the most interesting
and extremely useful areas of .NET architecture along with reflections and
attributes, but unfortunately very few people take interest in learning such
theoretical looking topics.