Пример #1
0
 internal static Func <T, int> LoadGetHashCodeDelegate <T>(bool isValueType, bool isObject, StructuralEqualityComparer structuralEqualityComparer)
 {
     if (isValueType)
     {
         return((value) => EqualityComparer <T> .Default.GetHashCode(value));
     }
     if (isObject)
     {
         return((value) => IsValueType(value) ?
                EqualityComparer <T> .Default.GetHashCode(value) :
                (value == null ? 0 : structuralEqualityComparer.GetHashCode(value)));
     }
     else
     {
         return((value) => value == null ? 0 : structuralEqualityComparer.GetHashCode(value));
     }
 }
Пример #2
0
 internal static Func <T, int> LoadGetHashCodeDelegate <T>(bool isValueType, bool isObject, StructuralEqualityComparer structuralEqualityComparer)
 {
     if (isValueType)
     {
         return((value) => EqualityComparer <T> .Default.GetHashCode(value !)); // J2N TODO: Note that value can be null here, need to investigate how to override the interface
     }
     if (isObject)
     {
         return((value) => IsValueType(value) ?
                EqualityComparer <T> .Default.GetHashCode(value !) : // J2N TODO: Note that value can be null here, need to investigate how to override the interface
                (value == null ? 0 : structuralEqualityComparer.GetHashCode(value)));
     }
     else
     {
         return((value) => value == null ? 0 : structuralEqualityComparer.GetHashCode(value));
     }
 }