[Mono-list] Mono or .NET?

Robert Jordan robertj at gmx.net
Tue Jun 15 14:19:43 EDT 2010


On 15.06.2010 16:08, Stifu wrote:
>
> Hello,
>
> Something like this:
>
> ///<summary>
> /// Checks whether the framework used is Mono.
> ///</summary>
> ///<returns>True (using Mono) or false (not using Mono).</returns>
> public static bool IsMono()
> {
> 	return Type.GetType("System.MonoType", false) != null;

Type.GetType("Mono.Runtime") is a little bit safer because it's
the documented way to detect Mono.

Robert


> }
>
>
> SuperCiccio wrote:
>>
>> How can I determine whether I am running in Mono or .NET (if I detect that
>> I am in Windows through Environment.OSVersion)? I need to do different
>> things in code, rather then compile different versions.
>>
>




More information about the Mono-list mailing list