.NET对象哈希码该怎么办?

编程入门 行业动态 更新时间:2024-10-24 04:36:57
本文介绍了.NET对象哈希码该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

C#中的对象具有四个方法-{ Equals , GetType , ToString , GetHashCode }.br>某人可以对哈希码做什么样的有用的事情?

An object in C# has four methods - {Equals, GetType, ToString, GetHashCode}. What sort of useful thing could someone do with the hash-code?

推荐答案

某人可以对哈希码进行哪些有用的事情?

What sort of useful thing could someone do with the hashcode?

快速找到可能个相等的对象.

Quickly find potentially equal objects.

尤其是,这种方法通常由 (用于密钥)和 HashSet< T> .

In particular, this method is usually used by types such as Dictionary<TKey, TValue> (for the keys) and HashSet<T>.

您应该不假定具有相同哈希码的对象是相等的.参见 Eric Lippert的博客文章获取更多信息,而 Wikipedia哈希表页上的哈希码的使用.

You should not assume that objects with equal hash codes are equal, however. See Eric Lippert's blog post for more information, and the Wikipedia hash table page for a more general discussion on the uses of hash codes.

更多推荐

.NET对象哈希码该怎么办?

本文发布于:2023-11-16 07:37:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1602294.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对象   NET   哈希码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!