为什么 Hashtable 不是 PascalCase?

发布于 2024-09-12 18:49:36 字数 173 浏览 1 评论 0原文

我强烈尝试遵循编码风格的一般规则。但是当我查看 .NET 时,我发现某些类与 PascalCasing 规则不匹配。其中之一是Hashtable,另一个我记得的是Stopwatch。我想还有更多我不记得了。

是否有理由为这些类保留 PascalCasing 规则?

I strongly try to follow general rules in coding styles. But when i look at .NET, i see that some of classes doesn't match PascalCasing rules. One of them is Hashtable and the other one which i remember is Stopwatch. I think there are more which i don't remember them.

Is there a reason to leave PascalCasing rules for those classes ?

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

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

发布评论

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

评论(3

凉城已无爱 2024-09-19 18:49:36

因为它们都是字典单词。

您可能需要哈希表的技术词典,但 stopwatch 是一个合法的词。
PascalCasing 适用于将不同单词组合到类名称(* 等)的情况,它与单词的语言起源无关。

Because they are both dictionary words.

You probably need a technical dictionary for hashtable, but stopwatch is a legitimate word.
PascalCasing is for cases where you combine different words to the name of your class (* and such), it isn't concerned with the linguistic origin of the word.

苍风燃霜 2024-09-19 18:49:36

这主要是旧代码,而不是有意为之。有些人会称之为错误。 Imo 秒表的大小写正确(秒表与哈希表,注意空白)。

有趣的是:javas Hashtable 也不是 PascalCase,而新的 HashMap 是(这里我确信这是一个错误,正如 josh bloch 在 effective java afaik 中所说的那样)

Thats mostly old code and not by purpose. Some would call it a mistake. Imo Stopwatch is correctly cased (stopwatch vs hash table, notice the blank).

Funny note: javas Hashtable is not PascalCase either while the new HashMap is (here im sure it was a mistake as josh bloch says so in effective java afaik)

來不及說愛妳 2024-09-19 18:49:36

它不是一个“哈希表”,而是一个“哈希表”(据我所知),因此该单词的 PascalCasing 将是准确的。 “秒表”也一样。不过哈希表可能是错误的。

It is not a "hash table" but a "hashtable" (as far as I know), so the PascalCasing of that word would then be accurate. Same for "stopwatch". Could be wrong about hashtable though..

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