General | VB.NET | C# |
End of a code line | New line | ; |
Comment | ' | // or /* ... */ |
32-bit integer | Integer | int |
32-bit floating point | Single | float |
Letter literal for double | R | D |
Letter literal for decimal | D | M |
Letter literal for short | S | no equivalent |
Division | / | / - one operand must be a floating point number |
Integer Division | \ | / - both operands must be integers |
Modulus (Division Remainder) | Mod | % |
If block | If condition Then ... End If | if (condition) { ... } |
If Else block | If condition Then ... Else ... End If | if (condition) { ... } else { ... } |
If ElseIf | If condition Then ... ElseIf condition Then ... End If | if (condition) { ... } else if (condition) { ... } |
Check for equality | = | == |
Check for inequality | <> | != |
Specify index to array | arr(...) | arr[...] |
Instantiate an array by size | New Sometype(highestindex) {} | new sometype[numberelements] |
Instantiate an array elements | New Sometype() {..., ..., ...} | new sometype[] {..., ..., ...} |
Increment variable by one | no equivalent | ++variable or variable++ |
Decrement variable by one | no equivalent | --variable or variable-- |
Literal character | "A"c | 'A' |
Boolean 'and' operator | AndAlso | && |
Boolean 'or' operator | OrElse | || |
Boolean 'not' operator | Not (followed by boolean) | ! |
Binary 'and' operator | And | & |
Binary 'or' operator | Or | | |
Binary 'not' operator | Not (followed by integer) | ~ |
Binary 'xor' operator | Xor | ^ |
For Loop | For variable = initial To final Step value ... Next | for (initial ; condition ; statement on loop) { ... } |
While Loop | While condition ... End While | while (condition) { ... } |
Do Loop | Do [Until/While condition] ... Loop [Until/While condition] | do { ... } loop while (condition) |
Reference to the own class | Me | this |
Escape sequence for a quote in a string | "" | \" |
Escape sequence for a backslash | \ | \\ |
String concatenation | & | + |
Function | Scopeword Function fxnname(arguments) As returntype ... End Function | scopeword returntype fxnname(arguments) { ... } |
Sub | Scopeword Sub subname(arguments) ... End Sub | scopeword void subname(arguments) { ... } |
Pass by value | ByVal | (this is the default) |
Pass by reference | ByRef | out as output only, otherwise use ref |