static
string
Ser
<
T
>
(Type type,
object
obj,
string
fileName)
{
try
{
XmlSerializer ser = new XmlSerializer(type);
MemoryStream sw = new MemoryStream();
StreamReader sr = new StreamReader(sw, Encoding.ASCII);
ser.Serialize(sw, obj);
sw.Position = 0;
string ret = sr.ReadToEnd();
return ret;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return "";
}
{
try
{
XmlSerializer ser = new XmlSerializer(type);
MemoryStream sw = new MemoryStream();
StreamReader sr = new StreamReader(sw, Encoding.ASCII);
ser.Serialize(sw, obj);
sw.Position = 0;
string ret = sr.ReadToEnd();
return ret;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return "";
}