Closed DNikitenko closed 5 years ago
Thank you for your contribution!
I'll merge this PR, however, I'm considering well before merge, for example, consider more clerverly hash algorithm.
Sure, there is an effective built-in implementation for anonymous types, so I could just write
return new {Begin, End}.GetHashCode();
. Examples can be found here: https://codingsight.com/the-origin-of-gethashcode-in-net/
@DNikitenko It sounds good!
However, that code generate an object in heap each GetHashCode() invoking, doesn't it?
It will be a reason of GC (Garbage Collection).
By the way, I found a feature of Visual Studio 2019 that generate GetHashCode() implementation.
How do you think about this?
@DNikitenko Okay, I'll merge this pull request. And after does it, I'll change the implementation of the "GetHashCode()" to what Visual Studio generated.
I'll also implement IEquatable<T>
for good performance.
Anyway, thank you for your contributions! 👍
It would be useful to override GetHashCode method for the IPAddressRange, so that e.g. it can be used as a key in dictionary.