What is the difference between
private void DoSomething(int value) {
value++;
}
and
private int DoSomething(int value)
Simply the first one won't work because you're operating on a copy of value.
You could do something like
private int DoSomething(ref int value)
{
value++;
}
and call it like
DoSomething(ref value);
This changes value to be passed in by reference. But really the only reason to do this is if you want to return more than one thing from your function. And normally there are better ways.
For extra bonus knowledge, there's also the out keyword which is similar to ref, but doesn't require value to be initialised first.