I have some objects in List, let\'s say List and MyClass has several properties. I would like to create an index of the list based on 3 properti
May I suggest an alternative - a anonymous object. It's the same we use in GroupBy LINQ method with multiple keys.
var dictionary = new Dictionary
It may looks strange, but I've benchmarked Tuple.GetHashCode and new{ a = 1, b = 2 }.GetHashCode methods and the anonymous objects wins on my machine on .NET 4.5.1:
Object - 89,1732 ms for 10000 calls in 1000 cycles
Tuple - 738,4475 ms for 10000 calls in 1000 cycles