add IsUnity property

pull/14605/head
Jan Tattermusch 7 years ago
parent cfae76b28b
commit a1b0ee2a48
  1. 10
      src/csharp/Grpc.Core/Internal/PlatformApis.cs

@ -36,6 +36,7 @@ namespace Grpc.Core.Internal
static readonly bool isWindows;
static readonly bool isMono;
static readonly bool isNetCore;
static readonly bool isUnity;
static PlatformApis()
{
@ -54,6 +55,7 @@ namespace Grpc.Core.Internal
isNetCore = false;
#endif
isMono = Type.GetType("Mono.Runtime") != null;
isUnity = Type.GetType("UnityEngine.Application, UnityEngine") != null;
}
public static bool IsLinux
@ -76,6 +78,14 @@ namespace Grpc.Core.Internal
get { return isMono; }
}
/// <summary>
/// true if running on Unity platform.
/// </summary>
public static bool IsUnity
{
get { return isUnity; }
}
/// <summary>
/// true if running on .NET Core (CoreCLR), false otherwise.
/// </summary>

Loading…
Cancel
Save