Coming straight from VB6 (and .NET) to C#, I encountered some "logistic" problems in the way the new MS language handles objects and structs.
Let's suppose we have
Code:
cDummy dummy_obj =
new cDummy
(dummyparams
);
cDummy dymmy_copy =
null;
In VB, an assignment like
simply makes dummy_copy reference the same object referenced by dummy_obj.
So, my first question is:
- In c#, does the same thing happen?
Let's go a little further.
Suppose we have a class with a private object of class cDummy, and a property that returns this object
Code:
private cDummy dummy_obj;
public property GetObject
{
get
{
return dummy_obj;
}
}
- Does the property returns a COPY of the object or a REFERENCE to the object?
If I do:
Code:
cDummy dummy_copy;
dummy_copy = dummyclass.GetObject;
does dummy_copy hold a copy of the object in dummyclass OR a reference to the same object?
And WHY I can't pass "byref dummyclass.GetObject" to functions?