Think of out as the way the parameter works as a return value.
So they are very similar:
void Foo(out int result) { result = 5; } int Foo() { return 5; }
And then think of ref as a way to resolve a parameter to both input and output.
So, in your example, if you declared your method:
public void AddToList(ref SomeClass Item)
Then the caller needs to write something like:
SomeClass i = null; obj.AddToList(ref i);
This would be illegal, for example:
obj.AddToList(ref new SomeClass());
They will be forced to pass the variable name, not the expression, so the AddToList method can store the value in the variable. By adding the ref prefix, you allow your method to turn the passed variable into another object.
source share