Passing array elements by reference

D

Dominic

If I have a method

private void Set(ref uint x)
{
x = 3;
}

how do I use this with an array element?

uint[] a = new uint[10];
Set(a[1]);

complains that it cannot convert argument 1 from uint to ref uint.

TIA

Dom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top