shouzama
Active member
Coming straight from VB6 (and .NET) to C#, I encountered some "logistic" problems in the way the new MS language handles objects and structs.
Lets suppose we have
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?
Lets go a little further.
Suppose we have a class with a private object of class cDummy, and a property that returns this object
- Does the property returns a COPY of the object or a REFERENCE to the object?
If I do:
does dummy_copy hold a copy of the object in dummyclass OR a reference to the same object?
And WHY I cant pass "byref dummyclass.GetObject" to functions?
Lets suppose we have
C#:
cDummy dummy_obj = new cDummy(dummyparams);
cDummy dymmy_copy = null;
In VB, an assignment like
Code:
dummy_copy = dummy_obj
So, my first question is:
- In c#, does the same thing happen?
Lets go a little further.
Suppose we have a class with a private object of class cDummy, and a property that returns this object
C#:
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:
C#:
cDummy dummy_copy;
dummy_copy = dummyclass.GetObject;
And WHY I cant pass "byref dummyclass.GetObject" to functions?