gpt4 book ai didi

c# - 核心 clr 中的 Environment.Version 等价物

转载 作者:行者123 更新时间:2023-11-30 16:50:23 25 4
gpt4 key购买 nike

以下代码适用于dnx451 框架,但不适用于dnxcore50

string ver = Environment.Version

此方法不存在:

enter image description here

dnxcore50 框架中是否有等效的属性?

更新

根据 Victors 的回答,您可以使用 PlatformServices.Default.Runtime 例如:

Console.WriteLine("env: {0} {1}", PlatformServices.Default.Runtime.RuntimeType, PlatformServices.Default.Runtime.RuntimeVersion);

输出:(在 dnx451 上)

env: Clr 1.0.0-rc1-16231

输出:(在 dnxcore50 上)

env: CoreClr 1.0.0-rc1-16231

最佳答案

您可以使用 IRuntimeEnvironment 中的属性获取有关运行时的信息。以下属性可用:

  • 运行时类型
  • 运行时架构
  • 运行时版本
  • 运行时路径

关于c# - 核心 clr 中的 Environment.Version 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35145661/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com