![](/img/trans.png)
[英]System.PlatformNotSupportedException Compiling C# code at runtime .NET Core
[英]System.PlatformNotSupportedException when trying to read a JPEG image in C# in Visual Studio for Mac
如何使用 Visual Studio for Mac 将 JPEG 文件读入 C# 中的 memory?
我的代码:
using AppKit;
using Foundation;
namespace TouristFree
{
[Register("AppDelegate")]
public class AppDelegate : NSApplicationDelegate
{
public AppDelegate()
{
}
public override void DidFinishLaunching(NSNotification notification)
{
var filename = "/Users/person/Desktop/image.jpeg";
var image = System.Drawing.Image.FromFile(filename); // <— error here
}
}
}
引发 System.PlatformNotSupportedException。
要加载应用程序包之外的图像(从 Mac 文件系统):
NSImage image = new NSImage("/Users/person/Desktop/image.jpeg")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.