Re: Why Serialization

Tech-Archive recommends: Fix windows errors by optimizing your registry



Henry,

As I wrote in my previous reply you cannot deep copy an arraylist object.
(You can copy an array, but if that contains reference types not more than
as a shalow copy)

The arraylist (as all methods inheriting from the list class) contains a
clone and the copyto method.

You can read more about this methods including the deep copy if you take a
deeper look at the Clone and CopyTo methods on this page.

http://msdn2.microsoft.com/en-us/library/system.collections.arraylist_methods.aspx

I hope this helps,

Cor

"Henry Jones" <henryjones@xxxxxxxx> schreef in bericht
news:umGwzM%23vGHA.2260@xxxxxxxxxxxxxxxxxxxxxxx
I can understand that you can do it, but why would you need to do it? You
said that you can store a control in the state it is, but for the array
example, why can't you just pass they array as an object?

Thanks,
Henry

"Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx> wrote in message
news:%23UoJyI%23vGHA.3372@xxxxxxxxxxxxxxxxxxxxxxx
Henry,

For a lot of situations, one of them can be that you want to store a
control in the state as it is, but you can also use it to sent an object
in the state it is pver the line without XML serialization.

It is also used to make a deep copy of objects by the way, because there
are only few classes who have methods for that. (The dataset and the
datatable have those by instance).

It is simple to do, see here a sample of that.

http://www.vb-tips.com/dbpages.aspx?ID=7ffd296f-9e81-47e6-88dc-61641f5c8d9d

I agree that this is not the only method, but a lot of people like to do
it this way.

I hope that this helps sofar,

Cor

"Henry Jones" <henryjones@xxxxxxxx> schreef in bericht
news:OIPuND%23vGHA.1296@xxxxxxxxxxxxxxxxxxxxxxx
I read a bit on Serialization and came up with the following definition:

The System.Runtime.Serialization namespace contains classes that can be
used for serializing and deserializing objects. Serialization is the
process of converting an object or a graph of objects into a linear
sequence of bytes for either storage or transmission to another
location. Deserialization is the process of taking in stored information
and recreating objects from it.



My question is why would someone want to do this? In doing some more
investigation, I understand you can an array list, or a TreeView. Can't
you just create the same thing in a new class or on another form by
doing a new query? Is it such a big deal?



Please help me figure out what I am missing by all this.



Thanks








.



Relevant Pages

  • Re: Roll your own std::vector ???
    ... For the sake of your comprehension, forget about pointers ... to always provide all of the overhead of a deep copy just in case that is what ... but those of reference types are simply "pointed to" by the ... | type of array element may be a value type or a reference type ??? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Array Copy Concept Questions
    ... Here is what can happen when using arrays to hold objects of Junk. ... At this point what we have done is executed a deep copy of the references to the Junk objects. ... The arrays are different objects but their elements reference the same Junk objects. ... Bottomline is when you did your deep copy of the pins array you essentially did a deep copy of the references to the objects. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: strcat not working
    ... str is an array of character pointers. ... Note the d is missing from deep. ... getchis non-standard. ...
    (comp.lang.c.moderated)
  • Shalow copy vs Deep copy
    ... I wanted to perform a deep copy of an array. ... A shallow copy of an Array copies only the elements of the ... copy the objects that the references refer to. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Serialization with XmlSerializer: how to set the XML root node to something different from <
    ... > So if it is an array of Foo that is being returned, ... The point here is not controlling the serialization of the elements of an ... array, but of the array itself, in other words of the xml root element. ... array is indeed very simple (XmlArrayAttribute and XmlArrayItemAttribute is ...
    (microsoft.public.dotnet.xml)