Thanks for reply..that's the same conclusion I've come to. It would be nice
if Microsoft would include a .copyToByVal method with the 2005 issue.
"Hal Rosser" wrote:
[color=blue]
> I think you're gonna have to write some code
>
> "Dennis" <Dennis@discussions.microsoft.com> wrote in message
> news:089CD328-4700-4CEB-AA76-46AE4A63EDE0@microsoft.com...[color=green]
> > I have several Data Structures, say "mystruct" which contain arrays of[/color]
> bytes,[color=green]
> > other structures, etc. I then dimension a variable (var1) as "mystruct"[/color]
> and[color=green]
> > set the various elements var1 to data. I then dimension another variable
> > (var1save) as "mystruct" and set var1save = var1 with the intent of[/color]
> changing[color=green]
> > var1 data elements and subsequently reasigning var1 back to it's original
> > values of var1save.
> >
> > VB.Net makes only a shallow copy of var1 in var1save for anything other[/color]
> than[color=green]
> > a simple varable type, i.e., only references for any arrays in the[/color]
> structure[color=green]
> > are copied to var1save. Thus, everytime I change a var1 array variable,
> > var1save also reflects the new value thus negating the intent of saving[/color]
> var1[color=green]
> > for future reinstatment.
> >
> > Currently I have to copy each sub-element of var1 into var1save[/color]
> individually[color=green]
> > in order to make a deep copy.
> >
> > Is there any way to do a deep copy on objects other than breaking them[/color]
> down[color=green]
> > into their simple elements and copying each one? This is very annoying to
> > have to write several lines of code to just copy one variable object to
> > another of the same type..
> >
> >
> > --
> > Dennis in Houston[/color]
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (
http://www.grisoft.com).
> Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004
>
>
>[/color]