Passing parameters to methods
using System;
class ParameterTest {
static void SomeFunction(int[] ints, int i) {
ints[0] = 100;
i = 100;
}
public static void Main() {
int i = 0;
int[] ints = { 0, 1, 2, 4, 8 };
Console.WriteLine("i = " + i);
Console.WriteLine("ints[0] = " + ints[0]);
Console.WriteLine("Calling SomeFunction...");
SomeFunction(ints, i);
Console.WriteLine("i = " + i);
}
}
Related examples in the same category