2010-06-07 42 views
2

我需要使用.NET或MONO进行C#/ F#编程。 我如何知道我的C#/ F#代码在哪个平台上运行?如何检测我的C#/ F#代码在单声道或.NET上运行的平台?

+0

可能重复(http://stackoverflow.com/questions/721161/how-to-detect [如何检测哪个.NET运行时正在使用(MS与单声道)?]哪位净运行时被感使用的-MS-VS-单声道) – 2014-10-29 16:16:04

回答

6

你不应该这样做。但是,如果确实有必要,您可以检查Mono.Runtime类型。从Mono FAQ:的

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"); 
相关问题