gpt4 book ai didi

c# - 以 "Does"开头的方法名称看起来不错吗?

转载 作者:可可西里 更新时间:2023-11-01 08:13:53 24 4
gpt4 key购买 nike

方法名称以“Does”开头(在 C# 中)是否是一种好的做法?我觉得有点奇怪,所以我想听听你的意见。

我正在写一个检查帐户是否存在的方法,签名应该是“bool DoesAccountExist(id)”?有更好的名字吗?

谢谢!

最佳答案

在这种情况下,我个人会选择 AccountExists(id),因为它在 if block 中看起来更自然

if (AccountExists(id)) { }

关于c# - 以 "Does"开头的方法名称看起来不错吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5887450/

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