|
Purpose
|
Visual Basic .NET
|
Visual C# .NET
|
|
|
Object Oriented Programming
|
|
|
|
|
Indicates a class constructor
|
Public
Class Class1
Public
Sub New(..)
MyBase.New
End Sub
End
Class
Note: You have to call
the base class constructor explicitly in Visual Basic .NET.
|
public
class Class1
{
public Class1(..)
{
}
.
}
Note: The call to the base class constructor (base()) is generated
automatically by the compiler in Visual C# .NET if you do not include
constructor initializers.
|
|
|
Indicates a class
destructor
Note: The Destructor
or Finalize method is called by garbage collection.
|
Protected
Overrides Sub Finalize()
m_Gadget
= Nothing
m_Gear
= Nothing
MyBase.Finalize()
End
Sub
|
public
class Class1
{
public ~Class1()
{
.
}
}
|
|
|
Declares a class
|
Class
|
class
|
|
|
Indicates class inheritance
|
Public
Class A
Inherits B
End
Class
|
public
class A : B
{
}
|
|
|
Indicates that the class can
only be inherited and cannot be instantiated
|
MustInherit
|
abstract
|
|
|
Indicates that the class
cannot be inherited
|
NotInheritable
|
sealed
|
|
|
Calls your own implementation
of the method instead of an overridden method in the derived class
|
MyClass
|
None
|
|
|
Refers to a base class from
the derived class
|
MyBase
|
base
|
|
|
Declares a type-safe reference
to a class method
|
Delegate
|
delegate
|
|
|
Indicates that the method or
the property overrides the implementation in its base class
|
Overrides
|
override
|
|
|
Indicates that these methods
have no implementation and must be implemented in derived classes
|
MustOverride
(in MustInherit
class)
|
abstract
(in
abstract
class)
|
|
|
Indicates that the method or
the property cannot be overridden in derived classes
|
NotOverridable
Note: By
default, methods are not overridable.
|
sealed
|
|
|
Indicates that the method or
the property can be overridden in an inheriting class
|
Overridable
|
virtual
|
|
|
Overloads a procedure, a
function, or a method
|
Overloads
|
None.
Define functions with same name but different signatures.
|
|
|
Specifies that a variable can
contain an object whose events you want to handle
|
WithEvents
|
No
specific keyword
|
|
|
Specifies the events for which
an event procedure will be called
|
Handles (Event procedures can still be associated with a WithEvents
variable by naming pattern.)
|
n/a
|
|
|
Evaluates an object expression
one time to access multiple members
|
With objExpr
<.member>
<.member>
End
With
|
n/a
|
|
|
Refers to the current object
|
Me
|
This
|
|
|
Declares an enumerated type
|
Enum
End Enum
|
Enum
|
|
|
Declares an interface
|
Interface
|
interface
|
|
|
Implements an interface
|
Implements
|
class
C1 : I1
|
|
|
Indicates an indexer
|
Default
Property
|
public
string this[int index]
{
get
{return List[index];}
set
{List[index]=value;}
}
|
|
|
Class Access Modifiers
|
|
|
|
|
Indicates that the modifier is
accessible outside the project or the assembly
|
Public
|
public
|
|
|
Indicates that the modifier is
accessible inside the assembly only
|
Friend
|
internal
|
|
|
Indicates that the modifier is
accessible only in the project (for nested classes, in the enclosing class)
|
Private
|
private
|
|
|
Class Member Access
Modifiers
|
|
|
|
|
Indicates that the modifier is
accessible outside the class and the project
|
Public
|
public
|
|
|
Indicates that the modifier is
accessible outside the class, but in the project
|
Friend
|
internal
|
|
|
Indicates that the modifier is
only accessible in a class or a module
|
Private
|
private
|
|
|
Indicates that the modifier is
accessible only to current and derived classes
|
Protected
|
protected
|
|
|
Indicates the union of
Protected and Friend or Internal
|
Protected
Friend
|
protected
internal
|
|
|
Indicates that the members are
shared across all instances
|
Shared
|
static
|
|
|
Miscellaneous Lifetime
|
|
|
|
|
Preserves the local variables
for the procedure
|
Static
|
n/a
|
|
|
Other
|
|
|
|
|
Calls the Windows API
|
Declare
statement
|
use
Platform Invoke
|
|
|
Indicates a comment
|
, Rem
|
//, /*
*/ for miltine comments,
/// for XML comments
|
|
|
Indicates a constant
|
Const
|
Const,
readonly
|
|
|
Creates a new object
|
New, CreateObject
|
new
|
|
Declares a function or a
method with no return value
|
Sub
|
void
|
|
Declares that an object can be
modified asynchronously
|
n/a
|
volatile
|
|
Declares a variable
|
Private,
Public, Friend, Protected, Static, Shared, Dim
|
declarators
(keywords include user-defined types and built-in types)
|
|
Declares a variable explicitly
|
Option
Explicit
|
None
(All variables must be declared before use)
|
|
Declares and raises an event
|
Event,
RaiseEvent
|
event
|
|
Declares a structure
|
Structure
End
Structure
|
struct
|
|
Defines a default property
|
Default
|
by
using indexers
|
|
Declares a null object
|
Nothing
|
null
|
|
Declares a namespace
|
Namespace
End
Namespace
|
Namespace
{
}
|
|
Indicates namespace usage
|
Imports
|
using
|
|
Retrieves a character from a
string
|
GetChar
Function
|
[ ]
|
|
Returns the address of a
function
|
AddressOf
(For class members, this operator returns a reference to a function in the
form of a delegate instance)
|
delegate
|
|
Tests for a null
object
|
Obj Is
Nothing
|
obj ==
null
|
|
Tests for a database
null expression
|
IsDbNull
|
n/a
|
|
Threads primitives
|
SyncLock
|
lock
|
|
|
|
|
|
|
|