我有这个代码:
IList<Type> lista = new List<Type>();
lista.Add(typeof(Google.GData.YouTube.YouTubeEntry));
using (FileStream writer = new FileStream("c:/temp/file.xml", FileMode.Create, FileAccess.Write))
{
DataContractSerializer ser = new DataContractSerializer(videoContainer.GetType(), lista);
ser.WriteObject(writer, videoContainer);
}
这对我产生了这个异常:Type 'Google.GData.Client.AtomUri' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.
我无法编辑Google.GData.Client.AtomUri
添加这些属性(它是一个库)。
那么,我该如何解决这个问题呢?