[Mono-devel-list] Determine the name and/or kind ofCLI runtime environment

Kornél Pál kornelpal at hotmail.com
Tue May 31 07:43:05 EDT 2005


>From: "Jonathan Pryor"
> That isn't likely to be any better, as Mono.Posix should be usable under
> Portable.NET, and a subset should be usable under .NET as well
> (Mono.Unix.Stdlib, to be exact).

I think absolutely the same.

By the way I found much prettier solution:
string runtimeName;
switch (runtimeName = typeof(object).GetType().FullName)
{
 case "System.RuntimeType":
  runtimeName = "Microsoft .NET Framework";
  break;
 case "System.MonoType":
  runtimeName = "Mono";
  break;
 case "System.Reflection.ClrType":
  runtimeName = "DotGNU Portable.NET";
  break;
 default:
  runtimeName = string.Format("Unknown ({0})", runtimeName);
  break;
}
Console.WriteLine(string.Format("Runtime: {0}", runtimeName));

It has the disadvantage that this may change in the future but a internal
type can be removed as well.

Kornél




More information about the Mono-devel-list mailing list