Passing Object vs String as Method Paramter
<p>With the following code, I understand that getStringAgain(classOne.str1) is better than getAstring(classOne) because we only want to pass in what is necessary because of data hiding/encapsulation etc.</p>

<p>However, are there any memory benefits? Obviously the classOne object is larger than just a string, however since in both methods, we are passing in only a reference to an object, and therefore only the reference is copied to the stack, are they both just as efficient in terms of memory?</p>

<pre><code>Class ClassOne()
{
    public string str1 = "string1";
    public string str2 = "string2";
}

Class ClassTwo()
{
    public ClassTwo()
    {
        ClassOne classOne = new ClassOne();
        string a = getAstring(classOne);
        string b = getStringAgain(classOne.str1)
    }

    private string getAstring(ClassOne classOne)
    {
        return classOne.str1;
    }

    private string getStringAgain(string str)
    {
        return str;
    }
}
</code></pre>
