After this answer :
Why are these hashcodes equals?
I realized that GetHashCode intend is not to provide a unique identifier for an object.
The purpose of this test was that I have a business function with 6 parameters :
customerId
serviceId
startDate
EndDate
cmsThematicId
And I don't want to be able to call this function more than once with the same values
These parameters are inserted in the database, I could query with (customerId = @customerId
and serviceId = @serviceId
...), but I need to be efficient with a lot of combination so this is not a solution.
Edit :
Example :
Let's say I have a super user he need to register customers. A registration is made of 5 parameters : customerId, serviceId, startDate, EndDate, cmsThematicId. The process of registering is like this :
- you select the service (for instance "show hi with a big red button")
- you select the customer (who bought the service)
- you select the cmsThematicId (the web page if you want)
- you select the startDate (in a drop down list)
- you select the endDate (in a drop down list)
My form can't show a set of parameters that was already used.
For instance once the customer 1 is registered for the service "big red button" on the page "holidays in new york" for the month of january, the super user won't be see these set of parameters in the form.
So my process did this : - create all the possibility - compute each possibility's hashcode in a List - get the hashcode of each already used possibility (from the db) - remove the already used possibility from the list - display the form
problem is : hashcode are not unique , so I might remove a item even if it was not used.
is it clearer ?