|
Functionalities |
C# |
VB.Net |
|
Identifier |
Case sensitive |
Not case sensitive |
|
Instruction end |
; |
[CrLf] |
|
Multi line command |
[CrLf] |
_ |
|
Comment |
|
|
|
Line |
// |
'
REM |
|
Section |
/* */ |
[Unavailable] |
|
String |
" |
" |
|
Char |
' |
' |
|
Null value |
null |
Nothing |
|
Get char from string |
[] |
GetChar([String], [Index]) |
|
CrLf |
"\r\n" |
vbCrLf |
|
Operators |
|
|
|
|
& |
And |
|
|
&& |
AndAlso |
|
|
| |
Or |
|
|
|| |
OrElse |
|
|
== |
= |
|
|
+ |
+ |
|
|
- |
- |
|
|
* |
* |
|
|
/ |
/ |
|
|
!= |
<> |
|
|
> |
> |
|
|
< |
< |
|
|
>= |
>= |
|
|
<= |
<= |
|
|
! |
Not |
|
|
% |
Mod |
|
|
++ |
[Unavailable] |
|
|
-- |
[Unavailable] |
|
|
+= |
+= |
|
|
-= |
-= |
|
Modifiers |
|
|
|
|
private |
Private |
|
|
public |
Public |
|
|
protected |
Protected |
|
|
internal |
Friend |
|
|
protected internal |
Protected Friend |
|
|
static |
Shared |
|
|
[Automatic with different signature] |
Overloads |
|
|
sealed (class) |
NotInheritable |
|
|
sealed (method) |
NotOverridable |
|
|
abstract (class) |
MustInherit |
|
|
abstract (method) |
MustOverride |
|
|
new |
Shadows |
|
|
override |
Overrides |
|
|
virtual |
Overridable |
|
|
readonly |
ReadOnly |
|
|
volatile |
[Unavailable] |
|
Namespace |
|
|
|
Uses |
using [Namespace]; |
Imports [Namespace] |
|
Define |
namespace [name] {
.
} |
Namespace [name]
.
End Namespace |
|
Class |
|
|
|
Simple define |
[Modifier] class [Name] {
...
} |
[Modifier] Class [Name]
.
End Class |
|
Inheritance |
: |
Inherits |
|
Interface implementation |
: [Class*], [Interface] |
Implements |
|
Constructor |
|
|
|
Declaration |
[Modifier] [class name] ([Parameters]) {
.
} |
[Modifier] Sub New ([Parameters])
.
End Sub |
|
Instance creation |
new [Type]([Parameters] |
New [Type]([Parameters]) |
|
Variable |
|
|
|
Simple |
[Type] [Name]; |
Dim [Name] As [Type] |
|
With initialization |
[Type] [Name] = [Value]; |
Dim [Name] As [Type] = [Value] |
|
Method |
|
|
|
Method (procedure) |
[Modifier] void [Name]() {
.
} |
[Modifier] Sub [Name]([Parameters])
.
End Sub |
|
Method (function) |
[Modifier] [Type] [Name]([Parameters]) {
.
} |
[Modifier] Function [Name]() As [Type]
.
End Function |
|
Parameter by value |
[Default] |
ByVal |
|
Output parameter |
out |
ByRef |
|
Reference parameter |
ref |
ByRef |
|
Optional parameter |
[Unavailable] |
Optional |
|
Undefined parameter |
params |
ParamArray |
|
Instance access |
this |
Me |
|
Base class access |
base |
MyClass |
|
Base instance access |
base |
MyBase |
|
Return a value |
return |
Return |
|
Property |
|
|
|
Read / Write |
[Modifier] [Type] [Name] {
get {.}
set {...}
}
|
[Modifier] Property [Name]() As [Type]
Get
...
End Get
Set(ByVal Value As [Type])
.
End Set
End Property |
|
Read only |
[Modifier] [Type] [Name] {
get {.}
set {...}
}
|
[Modifier] ReadOnly Property [Name]() As [Type]
Get
...
End Get
End Property |
|
Write only |
[Modifier] [Type] [Name] {
get {.}
set {...}
}
|
[Modifier] WriteOnly Property [Name]() As [Type]
Set(ByVal Value As [Type])
.
End Set
End Property |
|
Indexer |
[Modifier] [Type] this([Parameters]) {
get {.}
set {...}
}
|
Default [Modifier] Property [Name]([Parameters]) As [Type]
Get
...
End Get
Set(ByVal Value As [Type])
.
End Set
End Property
|
|
Delegate |
|
|
|
Procedure |
[Modifier] delegate void [Name] ([parameters]); |
[Modifier] Sub Delegate [Name] ([Parameters]) |
|
Function |
[Modifier] delegate [Return type] [Name] ([parameters]); |
[Modifier] Function Delegate [Name] ([Parameters]) As Return type] |
|
Event |
|
|
|
Static |
[Instance].[event]+= new [EventHandler] ( [method] )
|
[Modifier] WithEvents [field] As [Type] [method] Handles [Field].[Event] |
|
Dynamic (add) |
[Instance] . [event] += new [EventHandler] ( [method] ) |
AddHandler [Instance] . [Event], AddressOf [Method] |
|
Dynamic (remove) |
[Instance] . [event] -= new [EventHandler] ( [method] ) |
RemoveHandler [Instance] . [event], AddressOf [method] |
|
Declaration |
[Modifier] [Delegate type] event |
[Modifier] Event [Delegate type] |
|
Launch |
[Event]([Parameters]) |
RaiseEvent [Event name]([Parameters]) |
|
Array |
|
|
|
Create |
Samples :
int[] t0;
int[4] t1;
int[] t2;
int[] t3 = new int[3];
int[] t4 = {1, 2, 3};
int[] t4 = {1, 2, 3}
|
Samples :
Dim t0() As Integer
Dim t1(3) As Integer
Dim t2 As Integer()
Dim t3 As Integer() = New Integer(2) {} 'Array with 3 items
Dim t4 As Integer() = New Integer() {1, 2, 3}
Dim t5 As Integer() = New Integer(2) {1, 2, 3}
|
|
Access |
[] |
() |
|
Resize |
[Unavailable] |
ReDim |
|
Enum |
[Modifier] enum [Name] { . }
|
[Modifier] Enum [Name]
.
End Enum |
|
Struct |
[Modifier] struct [Name] {
...
} |
[Modifier] Structure [Name]
.
End Structure |
|
Interface |
[Modifier] interface [Name] {
...
} |
[Modifier] Interface [Name]
.
End Interface |
|
Cast |
([Type name]) / as
|
CType, CBool, CByte, CChar, CDate,
CDbl, CDec, CInt, CLng, CObj, CShort,
CSng, CStr |
|
Get the type |
typeof ( [Type name] ) |
GetType ( [Type name] ) |
|
Is |
is |
TypeOf ([Instance]) Is [Type] |
|
Const |
[Modifier] const [Type ][Name] = [Value] |
[Modifier] Const [Name] As [Type] = [Value] |
|
If |
if ([Bool BLOCKED EXPRESSION {
...
} |
If [Bool expression]
...
End If |
|
For |
for( int I = ; I < [ii + 1]; i+=[iii]) {
...
} |
For i = To [ii] Step [iii]
...
Next i |
|
For Each |
foreach ([Type] [Name] in [Collection Instance]) {
.
} |
For Each [Name] As [Type] In [Collection instance]
...
Next |
|
Switch |
Sample:
switch (Welcome) {
case "Hello" :
return "Hello";
case "Hi" :
break;
case "Goofbye" :
default :
return "Goodbye";
}
|
Sample:
Select Case counter
Case 1 ' counter egals 1.
Return counter * 0.1
Case 2, 3 ' counter equals 2 ou 3.
|