On 2010-04-28, Tom Shelton <(E-Mail Removed)> wrote:
> On 2010-04-28, Miro <(E-Mail Removed)> wrote:
>> Hi,
>>
>> (vb.net vs2008)
>>
>> I understand the significance between memory pointers with a function using
>> byVal and byRef.
>>
>> However I have code that I want to do something like this:
>>
>> Dim UsMailmsg As MailMessage = EmailOrderClass.createEmailOrder(False,
>> cartOrderID)
>> For nI As Integer = 0 To SendToEmailAddresses.Count - 1
>> EmailOrderClass.sendEmailOrder(CustomerAddress,
>> ToEmailAddress, UsMailmsg) <------- this line
>>
>> Now When I am using the UsMailmsg, even though the function is specified as
>> "byVal" it will always pass in as a reference to a memory pointer.
>> How do I pass it in as a 'Direct Copy' of the variable.
>>
>
> The common way would to implement the IClonable.Clone method - which would
> return a deep copy of the object.
>
Building upon this - you should realy take a combination of mine and Cor's
replies

A common way to make a deep copy of an object is to serialize it
to a memorystream and then desearialize from the memorystream....
--
Tom Shelton