gethashcode Questions
6
Solved
As you know, GetHashCode returns a semi-unique value that can be used to identify an object instance in a collection. As a good practice, it is recommended to override this method and impleme...
Hardware asked 21/11, 2010 at 21:27
2
Solved
I've wondered about this, so I figure I'll ask it.
Most places you'll see use the same semantic logic for overriding Equals as GetHashCode for memberwise equality...however they usually use differ...
Inmate asked 12/10, 2010 at 5:55
5
Solved
From ValueType.cs
**Action: Our algorithm for returning the hashcode is a little bit complex. We look
** for the first non-static field and get it's hashcode. If the type has no
** non-static f...
Oxazine asked 1/10, 2010 at 17:28
5
Solved
I have override GetHashCode and Equals and both methods provide same results for different objects but why still getting false ?
class Program
{
static void Main(string[] args)
{
Console.Write...
Resolved asked 3/8, 2010 at 11:9
5
Solved
Hey all, I've been reading up on the best way to implement the GetHashCode() override for objects in .NET, and most answers I run across involve somehow munging numbers together from members that a...
Duda asked 23/7, 2010 at 17:31
1
Solved
I'm working on writing a compiler for a language running on .net and one of the things I would like it to do is to automatically generate the GetHashCode method, but I have several questions:
Is ...
Dodge asked 1/7, 2010 at 18:23
3
Solved
Folks, here's a thorny problem for you!
A part of the TickZoom system must collect instances of every type of object into a Dictionary<> type.
It is imperative that their equality and hash cod...
Seemaseeming asked 31/5, 2010 at 16:28
1
Solved
I was wondering whether the .Net HashSet<T> is based completely on hash codes or whether it uses equality as well?
I have a particular class that I may potentially instantiate millions of in...
Communism asked 16/3, 2010 at 14:32
1
Solved
I have such a class:
public class Cycle
{
public List<int> Edges
{
get;
private set;
}
public override bool Equals(object obj)
{
Cycle cycle = (Cycle)obj;
var list1 = cycle....
Frigid asked 27/10, 2009 at 11:26
11
Solved
According to MSDN, a hash function must have the following properties:
If two objects compare as equal, the GetHashCode method for each object must return the same value. However, if two objects ...
Chibchan asked 4/9, 2009 at 11:28
3
Solved
My question may duplicate Default implementation for Object.GetHashCode() but I'm asking again because I didn't understand the accepted answer to that one.
To begin with I have three questions abo...
Incarnate asked 16/7, 2009 at 19:28
4
Solved
I have an object for which I want to generate a unique hash (override GetHashCode()) but I want to avoid overflows or something unpredictable.
The code should be the result of combining the hash c...
Bellyful asked 3/7, 2009 at 12:43
2
Solved
Basically, I have the following so far:
class Foo {
public override bool Equals(object obj)
{
Foo d = obj as Foo ;
if (d == null)
return false;
return this.Equals(d);
}
#region IEquatabl...
Gluttonous asked 2/7, 2009 at 1:9
2
Solved
Everytime I write some data class, I usually spend so much time writing the IEquatable implementation.
The last class I wrote was something like:
public class Polygon
{
public Point[] Vertices {...
Renounce asked 7/6, 2009 at 22:37
5
Solved
I've read about 10 different questions on when and how to override GetHashCode but there's still something I don't quite get. Most implementations of GetHashCode are based on the hash codes of the ...
Roseberry asked 17/5, 2009 at 0:53
2
Solved
I read most questions on StackOverflow with regards to GetHashCode. But I am still not sure whether I have to override GetHashCode on reference types. I picked up the following from someones answer...
Duffie asked 20/4, 2009 at 18:15
© 2022 - 2024 — McMap. All rights reserved.