【发布时间】:2017-02-09 09:21:16
【问题描述】:
我有一个普通的类库,其中包含一个将字节数组转换为图像的函数。
现在我已经删除了那个类库并创建了一个同名的可移植类库,现在代码似乎不再工作了,并且在“FromStream”函数上给了我一个错误:
对“MarshalByRefObject”类型的引用声称它在“mscorlib”中定义,但找不到
using System;
using System.Drawing;
using System.IO;
namespace App.Converters
{
public static class Converter
{
public static Image ToImage(this byte[] byteArray)
{
try
{
return Image.FromStream(new MemoryStream(byteArray));
}
catch
{
throw new FormatException("Data is not an image");
}
}
}
}
我的项目目标是:
- .NET Framework 4.5
- ASP.NET Core 1.0
- Windows 8
- Windows Phone 8.1
- Xamarin.Android
- Xamarin.iOS
- Xamarin.iOS(经典)
这是因为我的目标框架之一不支持“某事”吗?那为什么VS让我使用并自动完成显示呢?
【问题讨论】:
标签: c# .net portable-class-library system.drawing