[英]convert between types image in silverlight wp7
I need to convert System.Collections.Generic.IENumerable to System.Windows.Media.Imaging.BitmapImage I select BitmapImage in LINQ syntax I need to convert System.Collections.Generic.IENumerable to System.Windows.Media.Imaging.BitmapImage I select BitmapImage in LINQ syntax
var localStore = from n in ((App)Application.Current).global_local_store//this Local_ImagesStore
where n.url == url
select n.bitmp;//BitmapImage
public struct Local_ImagesStore
{
public string url;
public BitmapImage bitmp;
}
How do I convert this?我该如何转换? I can't do this:
我不能这样做:
var result = new BitmapImage();
result=local_store;
return result;
You receive BitmapImage collection .您收到BitmapImage 集合。
var result = new BitmapImage();
result=local_store.FirstOrDefault();
return result;
should work.应该管用。
Check: http://msdn.microsoft.com/en-us/library/bb340482.aspx检查: http://msdn.microsoft.com/en-us/library/bb340482.aspx
Disclaimer: i never wrote silverlight for wp7.免责声明:我从未为 wp7 写过 silverlight。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.