I have a class that I want to construct, by deserializing it from a network stream.
public Anfrage(byte[] dis)
{
XmlSerializer deser = new XmlSerializer(typeof(Anfrage));
Stream str = new MemoryStream();
str.Write(dis, 0, dis.Length);
this = (Anfrage)deser.Deserialize(str);
}
The intention is that I just want to pass the byte[] and have a proper object, rather than using a method in another class.
Now, I know that I obviously cannot do this =.
I've read this question and currently am reading the article mentioned in it, but I am not sure wether I'm understanding it correctly.
Is my intention clear enough?
Is there a way to do what I want to get done here?
Thank you all.
thisin constructors for value types. It may not have the effect you expect, though.