我如何在运行时检查单声道

2 mono

默认情况下,mono不信任任何SSL连接.因此,如果在单声道上运行我想要发送消息而不是抛出异常.

我如何检查我是否在运行时在单声道下运行?(因为在编译时CLI不会知道)

tob*_*sen 8

我将引用Mono网站:

拥有依赖于底层运行时的代码被认为是错误的编码风格,但有时这些代码是解决运行时错误所必需的

using System; 
class Program {
    static void Main ()
    {
        Type t = Type.GetType ("Mono.Runtime");
        if (t != null)
             Console.WriteLine ("You are running with the Mono VM");
        else
             Console.WriteLine ("You are running something else");
    }
}
Run Code Online (Sandbox Code Playgroud)