I want to create a Dictionary<DateTime, Dictionary<APerson, AVisit>> struct and I want to supply an IEqualityComparer on the second dictionary that holds an APerson as key
If I only had the inner dictionary it would be
var f = new Dictionary<APerson, AVisit>(new PersonEqualityComparer());
But I cannot find a constructor to supply it in the declaration. Do I have to pass it in every child declaration of Dictionary<APerson, AVisit> or is possible to instruct the mother struct to have a specified IEqualityComparer all the time?
Yes (if by this you mean every instance of
Dictionary<APerson, AVisit>).No.
But, you can reorganize. Instead of
why not
Then you can supply exactly one instance of something that implements
You might even replace
Tuple<DateTime, APerson>with a custom type.