At the XmlSerializer constructor line the below causes an InvalidOperationException which also complains about not having a default accesor implemented for the generic type.
Queue<MyData> myDataQueue = new Queue<MyData>();
// Populate the queue here
XmlSerializer mySerializer =
new XmlSerializer(myDataQueue.GetType());
StreamWriter myWriter = new StreamWriter("myData.xml");
mySerializer.Serialize(myWriter, myDataQueue);
myWriter.Close();
The tilde (~) is a character in the standard ASCII character set that is provided on a conventional computer keyboard and is used in both writing and computer programming. It corresponds to ASCII code 126. The tilde is also sometimes known as the twiddle.
The logical OR operator ( || ) returns the boolean value true if either or both operands is true and returns false otherwise.
C operators are one of the features in C which has symbols that can be used to perform mathematical, relational, bitwise, conditional, or logical manipulations. The C programming language has a lot of built-in operators to perform various tasks as per the need of the program.
-= Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand. C -= A is equivalent to C = C - A.
It would be easier (and more appropriate IMO) to serialize the data from the queue - perhaps in a flat array or List<T>
. Since Queue<T>
implements IEnumerable<T>
, you should be able to use:
List<T> list = new List<T>(queue);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With