Exemplo n.º 1
0
    public static string SerializeToXml(PacketData data)
    {
        string xmlData = null;

        StringWriter stringWriter = null;

        XmlSerializer serializer = new XmlSerializer(data.GetType());

        stringWriter = new StringWriter();
        serializer.Serialize(stringWriter, data);

        xmlData = stringWriter.ToString().Replace(Environment.NewLine, " ");

        stringWriter.Close();

        return(xmlData);
    }