从.env/ .ini/将变量放在枚举中吗?

发布于 2025-02-10 20:53:53 字数 1447 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日记撕了你也走了 2025-02-17 20:53:54

如果配置值在程序运行期间没有变化 - 换句话说,它们在程序运行时是恒定的 - 您希望能够访问它们是

do_a_thing(startants.host.host.value,value,value, stonstants.port.value)

当然,这样做没有错。

If the configuration values do not change during the run of the program -- in other words, they are constant while the program is running -- and you want to be able to access them is

do_a_thing(Constants.host.value, Constants.port.value)

then sure, there's nothing wrong with doing it that way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文