D
daniel
This is a pretty basic-level question, but I'd really like to know, so
thanks for any help or pointers you can provide (like what I would
google for ;o)
Suppose:
<code>
myFunc()
{
SomeType myType = new SomeType;
Console.Write(myType.MyProperty);
bool whatever = myOtherFunc(myType);
}
myOtherfunc(SomeType passedType)
{
Console.Write(myType.ToString())
return true;
}
</code>
My question: since myType is a reference type, only one instance of this
object is ever created in memory, right? The Lead Software Architect
here (C++, no C# experience) was telling me about passing by reference--
is this implicitly done by reference types in C#? Also, could I pass by
value? Why would I want to?
All these questions are asked under the auspices of least amount of
overhead. My primary concern is good coding practices (and learning).
Thank you,
-daniel
thanks for any help or pointers you can provide (like what I would
google for ;o)
Suppose:
<code>
myFunc()
{
SomeType myType = new SomeType;
Console.Write(myType.MyProperty);
bool whatever = myOtherFunc(myType);
}
myOtherfunc(SomeType passedType)
{
Console.Write(myType.ToString())
return true;
}
</code>
My question: since myType is a reference type, only one instance of this
object is ever created in memory, right? The Lead Software Architect
here (C++, no C# experience) was telling me about passing by reference--
is this implicitly done by reference types in C#? Also, could I pass by
value? Why would I want to?
All these questions are asked under the auspices of least amount of
overhead. My primary concern is good coding practices (and learning).
Thank you,
-daniel