【发布时间】:2013-08-27 07:35:45
【问题描述】:
这是关于这个主题的另一个问题:How to use deserialized object?我的类中有一些变量有问题,现在我只是把[XmlIgnore]放在无法序列化的变量前面,所以类的序列化有效暂时。
我的班级是这样的:
public class Channel : INotifyPropertyChanged
{
public int Width { get; set; }
public int Height { get; set; }
[XmlIgnore]
public BitmapImage Logo { get; set; }
public string CurrentCoverURL { get; set; }
[XmlIgnore]
public SolidColorBrush Background { get; set; }
private string name;
public string Name
{
get { return name; }
set
{
name = value;
NotifyPropertyChanged("Name");
}
}
}
现在我还需要序列化 Bitmapimage 和 SolidColorBrush,这样我就可以将这些信息传递给我的下一个视图。
我找到了一种方法 (Serialize a Bitmap in C#/.NET to XML),但这不适用于 Windows 8 应用程序。 System.Drawing.Bitmap 在 Windows 8 中不可用。
有人可以帮我解决这个问题吗?
谢谢!
【问题讨论】:
标签: c# serialization windows-8 bitmap xml-serialization