"HuffmaN" <hu***********@gmail.comschrieb im Newsbeitrag
news:u1**************@TK2MSFTNGP02.phx.gbl...
Hi, wot 's meaning of "shallow copy"?
In this context it means:
A copy of the instance fields if the struct
fields of a valuetype are copied in the same way.
fields of a referencetype are set to the same instance.
>
"Jon Skeet [C# MVP]" <sk***@pobox.com>
??????:11*********************@i3g2000cwc.googlegr oups.com...
>Martijn Mulder wrote:
>>I just want to be sure about this. When I have code like this:
//data member
System.Drawing.Drawing2D.GraphicsPath graphicspath=new
System.Drawing.Drawing2D.GraphicsPath();
//method
public System.Drawing.Drawing2D.GraphicsPath GetGraphicsPath()
{
return graphicspath;
}
there is a reference, a pointer returned to 'graphicspath' and NOT a
copy of
the object?
If GraphicsPath is a class, then the value returned is a reference.
If GraphicsPath is a struct, then the value returned is a shallow copy
of the data.
(I don't have the docs to hand to check which is the case, but it's
worth knowing the general principles.)
Jon