Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using JetBrains.Annotations;
- namespace Cadwise.DressCode.Amidala.Commons.System
- {
- public static class EqualityRoutine
- {
- private const int MagicPrime = 397;
- public static int HashCombine(int hash, int value)
- {
- unchecked
- {
- return (hash * MagicPrime) ^ value;
- }
- }
- public static int HashCombine(int hash, [CanBeNull] object value)
- {
- unchecked
- {
- return (hash * MagicPrime) ^ (value?.GetHashCode() ?? 0);
- }
- }
- public static bool TrivialEquality([NotNull] object self, [CanBeNull] object right, out bool result)
- {
- if (ReferenceEquals(null, right))
- {
- result = false;
- return true;
- }
- if (ReferenceEquals(self, right))
- {
- result = true;
- return true;
- }
- result = false;
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement