User FAQs

If you have a question, please send it to us.


1) What is Serialisation ?
Converting an object into a stream of bytes is called serialisation.
This is useful when we want to transport, save or pass an object around.
For an object to be serialized it needs to inherit the ISerialize interface.
De-serialization is the reverse process of creating an object from a stream of bytes.


2) How can I deserialize JSON to an object ?
The quickest way is to use Visual Studio to create the corresponding class.
Copy your JSON to the clipboard.
Create your class.cs file and place your cursor underneath the "internal class".
Edit > Paste Special > Paste JSON as Classes
Move the elements from inside the Root object to inside your internal class and change the internal to public.
(If any of the classes already exist in the solution, then add a "_object" suffix.


3) What does the [Serializable] attribute do ?
specifies to the runtime that the instances of that class can be serialized using binary or XML serialization.

System.SerializableAttribute 
System.NonSerializableAttribute

[Serializable()]
public class MyClass

This can be applied to classes and methods.
Used to indicate that a class or method can be serialized.


4) How can you fix the following error ?

Cannot implicitly convert type 'System.Collections.Generic.List<string>' to 'string[]' 

This message appears when you are trying to convert a list of strings to an array of strings
The solution is to convert the list into an array.

myStringArray = myStringList.ToArray() 


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext