D
D
Danny Belchenko2013-12-07 09:33:01
.NET
Danny Belchenko, 2013-12-07 09:33:01

How to use serialization?

Quite often in the documentation for .NET projects I see this word - "serialization". Could you explain in more detail what it is and what it is for, as well as how to use it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladlen Grachev, 2013-12-07
@belchenko

Let me explain in a somewhat abstract way. Define your own terms. Let's say you have an object. Let it be an array. This is a complex data type.
Serialization allows you to reduce this object to a sequence of bytes (often it can be considered as a string created according to certain rules), which can later be deserialized, that is, the original object can be obtained from it.
What is it for? Save the complex object somewhere. For example, in a single database field, in a session, in cookies, just in a file. With the ability to get the original object in the future.
Or for transmission. Let's say you've collected data from a user from some form, getting an array of data. This data must be sent to the server. The query parameter can be a string, but not an array. Therefore, the array must be serialized before being passed.
How to use . There are also articles from Microsoft, and quite chewed from code-inside. In general, for every taste.
And your comments about the interest in serialization in C# are somewhat out of place. Very many terms and processes in programming change little from language to language. The only difference is the syntax and usage. The very essence is preserved.

O
OnYourLips, 2013-12-07
@OnYourLips

en.wikipedia.org/wiki/%D0%A1%D0%B5%D1%80%D0%B8%D0%...
There are many other interesting articles on this site.

_
_ _, 2013-12-07
@AMar4enko

Wiki writes that serialization is "the process of translating some data structure into a sequence of bits." And the downside is deserialization.
If you need to transfer a complex object using any transport (file, TCP-IP connection, etc.), you need to translate your object on one side into a byte sequence, and on the other side restore it from a byte sequence. This is serialization and deserialization.
All ultra-high-level programming languages ​​like C#, Ruby, Python, etc. have built-in serialization mechanisms, but sometimes developers override serialization / deserialization methods for some of their own purposes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question