Exemple #1
0
 /// <summary>
 /// Computes a hashcode for an object based on its fields.  Type resolution is done
 /// statically, which allows fast code (similar to hand-rolled performance).
 /// However, warning: if the instance is of compile-time type BaseType, but at runtime turns out
 /// to be SubClass, then only the fields of BaseType will be checked.
 ///
 /// This is simply a type-inference friendly wrapper around FieldwiseHasher&lt;&gt;.Instance
 /// </summary>
 /// <typeparam name="T">The type of the object to hash.</typeparam>
 public static int Hash <T>(T val)
 {
     return(FieldwiseHasher <T> .Instance(val));
 }
Exemple #2
0
 /// <summary>
 /// Computes a hashcode for an object based on its fields.  Type resolution is done
 /// statically, which allows fast code (similar to hand-rolled performance).
 /// However, warning: if the instance is of compile-time type BaseType, but at runtime turns out
 /// to be SubClass, then only the fields of BaseType will be checked.
 /// This is simply a type-inference friendly wrapper around FieldwiseHasher&lt;&gt;.Instance
 /// </summary>
 /// <typeparam name="T">The type of the object to hash.</typeparam>
 public static int Hash <T>(T val) => FieldwiseHasher <T> .Instance(val);