prosseek
prosseek

Reputation: 190659

How to detect what platform my C#/F# code is running on mono or .NET?

I need to use .NET or MONO for C#/F# programming. How do I know my C#/F# code is running on what platform?

Upvotes: 2

Views: 434

Answers (1)

Matthew Flaschen
Matthew Flaschen

Reputation: 284786

You shouldn't have to do this. However, if it's really necessary you can check for the type Mono.Runtime. From the 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");

Upvotes: 6

Related Questions