The following kinds of parameters are available:
Java
|
C#
|
VB.NET
|
value
|
value
|
ByVal
|
|
ref
|
ByRef
|
|
out
|
|
|
params
|
|
private static void Swap(ref int x, ref int y)
{
int temp = x;
x = y;
y = temp;
}
...
i = 42;
j = 27;
Swap(ref i, ref j);
// i has the value 27
// j has the value 42
-
As in C++,
in C#
a method is statically bound to its class
unless the keyword
virtual
appears in the declaration of the method.
-
If a subclass wishes to override a method
declared as virtual in a superclass,
the keyword
override
must appear in the method's declaration
in the subclass.
-
If a subclass does not wish to override
but instead wishes to provide its own method as well,
the keyword new
must appear in the method's declaration
in the subclass.