Linked Questions
23 questions linked to/from Serialize an object to string
0 votes
0 answers
225 views
How to convert any object to string and string to that object again C# [duplicate]
i have a string type list and i want to store in text file. For sake of this i want that my list is easily convert to string and i will store it to text file then i read the string from file and ...
55 votes
4 answers
35k views
C# XmlSerializer BindingFailure
I get a BindingFailure on a line of code using the XmlSerializer: XmlSerializer s = new XmlSerializer(typeof(CustomXMLSerializeObject)); The assembly with display name CustomXMLSerializeObject....
31 votes
4 answers
16k views
Encoding.UTF8.GetString doesn't take into account the Preamble/BOM
In .NET, I'm trying to use Encoding.UTF8.GetString method, which takes a byte array and converts it to a string. It looks like this method ignores the BOM (Byte Order Mark), which might be a part of ...
6 votes
1 answer
5k views
Xml serialization appending the \0 (backslash 0 or Null) character?
I am trying to serialize an object and the \0 (Null) character is being appended to the generated string. Why? My code: XmlSerializer serializer = new XmlSerializer(typeof(Common....
1 vote
2 answers
4k views
Serializing and Deserializing object in C# without using file system
I am attempting to save an object as serialized string and then I need to deserialize it back to an object at a later stage. I want to avoid using the file system. The serializing is being done with ...
2 votes
2 answers
3k views
Serializing lists with an object serializer
I am using the SerializableDictionary defined in this blog entry to store <string, object> data and pass it to/from a WCF service. This works fine if I use value types as the values, because ...
0 votes
2 answers
3k views
Convert C# class property into XML attribute
I am trying to convert properties of a C# class into XML attribute. public class MyClass { [XmlAttribute] public string c { get; set; } [XmlAttribute] public ...
2 votes
2 answers
1k views
Dynamics CRM Plugin Shared variables - Object or Array
We have a scenario where we need to calculate multiple fee components & share between Pre & Post stages of a Plugin. So we created the object like this. class FeeCalculation { ...
0 votes
1 answer
3k views
How to handle null in xml and c# -2
Let's consider that this was automatically generated xml file and in the second Address tag there is nothing. It is null. If it was not null , we are going to make a list for address and then ...
1 vote
3 answers
4k views
Serialize multiple objects into XML
I try the following code to serialize my objects into xml file, but when run this code the last item in the list values serialize by the count for the list. I want to serialize every item in the list?...
1 vote
2 answers
1k views
XmlSerializer to convert to XmlElement or string
I am storing developer notes in XML files within the project, to eliminate storing them on a SQL instance to reduce database calls. I have my class set up to be Serialized [Serializable] public ...
0 votes
2 answers
972 views
Parsing a class to function as an argument
I have some classes: public class clsAnimal { public int ID { get; set; } public string Strain { get; set; } } public class clsHybridom { ...
1 vote
1 answer
482 views
How does "System.Messaging" system recognises the types of the objects it sends and receives?
Edit: root cause of the question I'm working on an application, that uses System.Messaging and XML serialisation via XmlMessageFormatter. I would like to send an object, let's say Class1, having an ID ...
-2 votes
1 answer
316 views
is there an easy way to parse a class into a string in both directions
Suppose I have a simple class like that: public class Person { public string name; public int age; public Gender gender; //enum type //constructor } Is there a built-in way to parse ...
0 votes
0 answers
704 views
Saving polygon points to mysql database c#
I create polygons with mouse click events as follows: private void PrintMousePos(int x, int y, MouseEventArgs e) { PointF[] location = { new PointF(x, y) }; inverseTransform....