gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 07:43:01 29 4
gpt4 key购买 nike

此代码在升级到 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com