Silverlight プロジェクトで varbinary をイメージに変換しようとしています。
まず、サービスのデータベースからバイナリを取得します。
[OperationContract]
public byte[] getAfbeelding(int id)
{
var query = (from p in dc.Afbeeldings
where p.id == id
select p.source).Single();
byte[] source = query.ToArray();
次に、StackOverflow にあるコードを使用して、varbinary をイメージに変換しようとします。
public static string convertToImage(byte[] source)
{
MemoryStream ms = new MemoryStream(source);
Image img = Image.FromStream(ms);
return img.Source.ToString();
}
しかし、結局のところ、SilverlightImage
には..FromStream
'System.Windows.Controls.Image' does not contain a definition for 'FromStream'
ええ、私はちょっと道に迷っていて、何をすべきかわかりません。シルバーライトでこれを行う方法についてのアイデアはありますか?