The & operator is used to pass references to variables to methods with reference or out parameters. Changes to the parameter in the method are reflected in the variable that was passed by reference when control passes back to the calling method.
Parameters
- expression
-
A variable passed to the method.
Remarks
Example
The following example illustrates a use of the Reference (&) operator.
В | Copy Code |
---|
// Define Compute method in C# code.
public class C
{
public static void Compute(ref int sum, out int product, int a, int b)
{
sum = a + b;
product = a * b;
}
}
// Call Compute method from your JScript code.
var a : int, b: int;
C.Compute(&a, &b, 2, 3)
print(a);
print(b); |
See Also
Reference
ref (C# Reference)
out (C# Programmer's Reference)