本文介绍了需要序列化位图图像silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用 bitmapImage(现在由 xmlIgnore 标记)序列化自定义类.我正在使用 xmlSerialization,但我认为那很糟糕.您对如何序列化我的类有一些想法吗??也许您可以提供一些简单的示例??
I need serialize custom class with bitmapImage(tagged by xmlIgnore right now).I'm using xmlSerialization, but I think thats bad.Do you have some ideas how can I serialize my class??Probably you can provide some simple example??
class X
{
private BitmapImage someImage;
public BitmaImage{get;set}
}
其实以后我会用到WCF Service.谢谢)
Actually later I will be use WCF Service.Thanks)
推荐答案
您可以将 图像公开为字节数组,例如:
public byte[] ImageAsBytes
{
get { return BytesFromImage(someImage); }
set { someImage = ImageFromBytes(value); }
}
您当然可以使用流和 StreamSource
属性.
You can of course convert back using a stream and the StreamSource
property.
这篇关于需要序列化位图图像silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!