序列化文件錯誤

問題:當序列化XML文件時,出現錯誤
用以下方法:
XmlSerializer lizer = new XmlSerializer(typeof(MyType));

  錯誤如:spa

The assembly with display name 'mscorlib.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'mscorlib.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
 

 改變方法以下:blog

XmlSerializer lizer = XmlSerializer.FromTypes(new[] { typeof(MyType) })[0];

  則問題解決ci

相關文章
相關標籤/搜索