Linked Questions

1693 votes
25 answers
308k views

In .NET, the GetHashCode method is used in a lot of places throughout the .NET base class libraries. Implementing it properly is especially important to find items quickly in a collection or when ...
bitbonk's user avatar
  • 49.9k
429 votes
8 answers
454k views

I am trying to use a custom class as key for an unordered_map, like the following: #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; class ...
Alfred Zhong's user avatar
  • 7,191
22 votes
3 answers
9k views

public class Address{ public string ContactName {get; private set;} public string Company {get; private set;} //... public string Zip {get; private set;} } I'd like to implement a ...
Arithmomaniac's user avatar
25 votes
4 answers
17k views

I am more familiar with the "Java way" of building complex / combined hash codes from superclasses in subclasses. Is there a better / different / preferred way in Python 3? (I cannot find anything ...
kevinarpe's user avatar
  • 21.6k
20 votes
4 answers
18k views

I have a dictionary which is keyed by a List: private Dictionary<List<custom_obj>, string> Lookup; I'm trying to use ContainsKey, but it doesn't seem to be working, and I have no idea why....
Harry's user avatar
  • 873
7 votes
3 answers
13k views

I've made a custom "Coordinate" data structure which defines the position of an object according to a certain system. A coordinate is defined as follows: public class Coordinate { public int X; ...
A-Type's user avatar
  • 1,148
7 votes
3 answers
5k views

The compiler allows me to do the following: procedure MyProc(const ADynData: array of string); or procedure MyProc(const ADynData: TStringDynArray); and pass arbitrary data like so: MyProc(['Data1',...
James's user avatar
  • 82.4k
5 votes
2 answers
9k views

In converting .NET Core project to .NET Framework, one thing notice is using Hashcode now needs to be converted something equivalent. As can be read, Hashcode is specific to .NET core versions and ...
swcraft's user avatar
  • 2,132
6 votes
2 answers
5k views

When I use TObjectDictionary, where TKey is object, my application work uncorrectly. I have two units, thats contain two classes. First unit: unit RubTerm; interface type TRubTerm = Class(...
Andrew's user avatar
  • 167
10 votes
4 answers
1k views

Hi I have a class with 6 string properties. A unique object will have different values for atleast one of these fields To implement IEqualityComparer's GetHashCode function, I am concatenating all 6 ...
ganeshran's user avatar
  • 3,512
8 votes
2 answers
2k views

This reproduces the problem : program Project1; {$APPTYPE CONSOLE} uses Generics.Collections; type TStringRec = record s1 : string; s2 : string; end; TGetHash<TKey,TValue> = ...
J...'s user avatar
  • 31.5k
1 vote
2 answers
2k views

As part of my current project, I need to generate hashes for meshes in Unity. These are used to later check whether the mesh content has changed. Due to interface considerations, the hash ...
Tobl's user avatar
  • 671
0 votes
3 answers
627 views

So I searched for this "problem" and only came accross questions asking how to remove real duplicates from a list. But what I want is to remove every Object being equal to another Object in the list ...
Jakob's user avatar
  • 151
1 vote
3 answers
244 views

I have two lists and I'm trying to return items that are not in the other list. Here is my code: var Results = ListOne.Where(x => ListTwo.All(a => a.EmployeeNum != x.EmployeeNum && a....
Kane's user avatar
  • 43
0 votes
1 answer
880 views

I'm implementing a caching table to avoid having to perform a costly operation that creates a generic object from a set of parameters describing it. Once an object is requested, an hash of these ...
Michele M.'s user avatar

15 30 50 per page