class="c#" name="code">/// <summary>
/// 序列化List
/// </summary>
/// <param name="al"></param>
/// <returns>string</returns>
public string SerializeArrayList(ArrayList al)
{
Type[] extra = new Type[1];
extra[0] = typeof(LocalNetInfo);
// extra[0] = typeof(string);
XmlSerializer xs = new XmlSerializer(typeof(ArrayList), extra);
MemoryStream ms = new MemoryStream();
XmlTextWriter tw = new XmlTextWriter(ms, Encoding.Default);
xs.Serialize(tw, al);
tw.Close();
return Encoding.Default.GetString(ms.ToArray());
}
黑色头发:http://heisetoufa.iteye.com/