You can't actually do this in .NET. int
s are value types, so you can't make a reference to them directly.
There are a number of ways around this, however. Here's just one:
class IntReference
{
int Value { get; set; }
}
IntReference a = new IntReference() { Value = 10 };
IntReference b = new IntReference() { Value = 20 };
IntReference[] rihanna = { a, b };
for (int i = 0; i < rihanna.Length; i++)
rihanna[i].Value = rihanna[i].Value + 1;
Console.WriteLine("{0} {1} ", a.Value, b.Value); // "11 21"
Although you really shouldn't have to do this, ever. It goes counter to the design of value types in .NET.