c# - __MonoCS__ 在单声道 5.0 中不起作用。如何在编译时确定平台?

标签 c# .net build mono

此代码在升级到 mono 5.0 后损坏:

#if __MonoCS__ //Linux...
        var mode = LZ4StreamMode.Compress;
#else //Windows...
        var mode = System.IO.Compression.CompressionMode.Compress;
#endif

我可以用什么常量来代替?

最佳答案

this is noted in the release notes for mono 5.0以及推理:

Note: mcs defined the MonoCS symbol and some users incorrectly used it to conditionally compile code specific to Mono. This is considered bad practice and won’t work anymore now that csc is the default compiler. You can detect whether you’re running on Mono at runtime instead.

关于c# - __MonoCS__ 在单声道 5.0 中不起作用。如何在编译时确定平台?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43984301/

相关文章:

haskell - 由于 native 依赖项中的 "multiple definition"链接器错误,构建失败

c# - 多项选择题的所有可能排列

c# - 动态数据显示分散的日期时间轴

c# - 通过浏览器回击(按钮)时,临时数据不会变空(null)

c++ - 使用 visual studio 2012 构建 OpenCV 2.49

iOS:在构建阶段更改 info.plist

C# 图表 axisY2 调整(如何使它像 Excel 一样)

c# - NpgsqlConnection.Open 在 Npgsql.ConnectorPool.Allocate() 调用 Monitor.Enter 中被阻止

c# - 从 1.0.0-rc1-final 中的 appsettings.json 中读取一个值

c# - 在 C# 的 Windows 窗体中的 PictureBox 中显示 System.Windows.Media.Imaging.BitmapSource