@WikiNewPageEditViewToolsHelp
Create New Page Create New Page from Copy
Create your new wiki
Edit this page Copy from this page Rename
Attach (Upload) File
Edit Menu
Newest Change History Referer Trackback
Page List Tag Cloud RSS1.0 RSS2.0
Search
@Wiki Guide
FAQ/about @wiki FAQ/about Editting FAQ/about Register
Update Infomation Release Plan
VB.NET AND C# Description
 
NotInheritable
Sealed
Specifies that a class cannot be used as a base class, i.e. that it cannot be inherited.
NotOverridable
Sealed
Specifies that a method cannot be overridden.
MustInherit
Abstract
Specifies that a class can only be inherited (an instance of the class cannot be created).
MustOverride
Abstract
Specified that a method must be implemented in a derived class.
Overridable
Virtual
Specifies that a member can be overridden.
Shared
Static
Specifies that a member be shared by all instances of a class. An instance of the class is not required to call the member.
Static
No equivalent
Specifies that a local variable's value be preserved between calls.
Public
Public
Class/member is visible outside of project or assembly.
Friend
Internal
Class/member is invisible outside of the assembly.
Private
Private
Class/member is visible only within the project.
Overloads
not required
Specifies that a member is overloading another member.
Overrides
override
Specifies that a member is overriding another member.
Implements I1
class C1:I1
Specifies that the class (C1) implements the interface I1.
Inherits C2
class C1:C2
Specifies that the class (C1) inherits class C2.
Implements I1
Inherits C2
class C1:C2,I1
Specifies that the class (C1) implements the interface I1 and inherits class C2.
Shadows
new
 
Finalize
~C1 (destructor)
Method called by system just before garbage collection reclaims object. C1 is classname.
New
C1
Constructor method, called when object is created. C1 is classname.
Dim x as Int32
Int32 x
Declares variable x as type System.Int32.
Dim t1 As New SomeType()
Try
t1.SomeMethod()
Finally
If (t1 Is Nothing) Then
If TypeOf t1 Is IDisposable Then
CType(t1, IDisposable).Dispose()
End If
End If
End Try
using(SomeType t1 = new SomeType())
{
t1.SomeMethod;
}
 
Imports
using
Allows methods to be called without fully qualifying with Namespace name.
<> 
[]
Specifies parameters.
Function x as Int32
Sub y
Int32 x
void y
Specifies return values (Int32 and none).
_
;
Line continuation character in VB, end of line character in C#.
AndAlso
OrElse
&&
||
Short circuit versions of And and Or.
not supported
<< >>
Shift operators.
X+=1 (x=x+1)
X-=1 (x=x-1)
also *=, /=, ^= etc..
x++
x--
Short cut incrementers.
Dim x(4) as Int32
= 5 items (0 to 4)
Int32[] x = new Int32[4];
= 4 items (0 to 3)
Differences in array declarations and the number of elements created.
Dim x as Int32
Int32 x = 0
x initialised as zero automatically in VB.
ReDim Preserve
no equivalent
Redimensions an array.
Optional
need to overload sub instead
Specifies and optional parameter.
Select Case x
Case True
Case Else
End Select
switch(I)
{
case 1:break;
default:break;
};
 
ByVal
ByRef
not required
ref
Passing parameters by value and by reference.
Me
this
Refer to the current object.
MyBase
base
Refer to the base calss.
MyClass
no eqivalent
Make a non-virtual call to a virtual method of the current object.
Const
const
readonly
Declare a constant.
Enum
enum
Declare an enumerator.
Structure
struct
Declare a structure.
no equivalent
volatile
Declare that an object can be modifed asynchronously.
obj = Nothing
obj == null
Test for an object variable that does not point to anything.
Option Explicit
on by default and not changable
Specify that all variables must be declared.
IsDBNull
no equivalent
Test for a database Null.
Default
must use indexer
Specify default method of a class.
WithEvents
no equivalent
Declare a variable whose events you wish to handle.
Handles
no equivalent
Specify that the method is an event sink.
Try
Catch
Finally
End Try
try{}
catch{}
finally{}
Structured exception handling
If Number < 10 Then
Digits = 1
ElseIf Number < 100 Then
' Condition evaluates to True so the next statement is executed.
Digits = 2
Else
Digits = 3
End If
if (x > 10)
{
if (y > 20)
Console.Write("Statement_1");
}
else
Console.Write("Statement_2");
Conditions.
For I = 1 To 10
For J = 1 To 10
For K = 1 To 10
' Statements to operate with current values of I, J, and K.
Next K
Next J
Next I
for (int i = 1; i <= 5; i++)
Console.WriteLine(i);
Iterations.
REM
'
/* ... */
//
Comment lines
not supported
///
XML comment lines
Dim x As String = "Hello"
Dim y As Char = GetChar(x, 1)
string x = "hello";
char y;
y = x[1];
Retrieve a character from a String.
AddressOf
delegate
Use the address of a method.
With ... End With
no equivalent
Evaluate an object one and use many times.
Dim a() as Long = {1,2,3}
int[] x = new int[4] {1,2,3,4};
Initialise an array.
Event
RaiseEvent
event
Declare and raise an event.
SyncLock
lock
Threading primitives.
Defaults to Private Scope
- Variable in class
Defaults to Public Scope
- Variable in Structure
- Structure
- Class
- Method in Class
- Method in Structure
Defaults to Private Scope
- Variable in class
- Variable in struct
- Method in class
- Method in struct
Defaults to Public Scope
- struct
- class
 
no equivalent
public void ShowWord()
{
string Word;
myWord(out Word);
Console.Writeline("Word is " + Word);
}
public void myWord (out string Word)
{
Word = "Hello World";
}
An output parameter is a parameter that is passed from a called method to the method that called it, that is, the
reverse direction. Output parameters are useful if you want a method to return more than a single value.
see @
Visual Basic .NET
Help.ShowHelp(MyForm, "C:myHelpFile.htm")
Visual C#
Help.ShowHelp(MyForm, @"C:myHelpFile.htm");
@
 
 
Visual Basic .NET
Visual C# .NET
.NET Framework
Boolean
bool
System.Boolean
Byte
byte
System.Byte
Short
short
System.Int16
Integer
int
System.Int32
Long
long
System.Int64
Single
float
System.Single
Double
double
System.Double
Decimal
decimal
System.Decimal
Date
System.DateTime
System.DateTime
String
string
System.String
Char
char
System.Char
Object
object
System.Object
n/a
sbyte
System.Sbyte
n/a
ushort
System.UInt16
n/a
uint
System.UInt32
n/a
ulong
System.UInt64