I'm currently struggling to understand what it means when it's stated that with the 'out' keyword we're able to return multiple values. For example from the msdn site (https://msdn.microsoft.com/en-us/library/ee332485.aspx): "...The following examples uses out to return three variables with a single method call."
class OutReturnExample
{
static void Method(out int i, out string s1, out string s2)
{
i = 44;
s1 = "I've been returned";
s2 = null;
}
static void Main()
{
int value;
string str1, str2;
Method(out value, out str1, out str2);
// value is now 44
// str1 is now "I've been returned"
// str2 is (still) null;
}
}
I'm not sure if i'm just not reading the description right but it seems that Method() doesn't actually return (doesn't use the 'return' keyword) anything at all and basically assigns the fields (similarly through passing by ref). This is consistent with other sources where they state that using 'out' can return multiple values. Am i misunderstanding the context of the return word or is it something along the lines that i'm not understanding the concept properly?