hashcode calc should be unchecked

This commit is contained in:
mgravell
2011-04-22 13:04:31 +01:00
parent 5aeded6a06
commit 8ad6ebed97
+7 -4
View File
@@ -106,10 +106,13 @@ namespace Dapper
this.sql = sql;
this.connectionString = cnn.ConnectionString;
this.type = type;
hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this
hashCode = hashCode * 23 + (sql == null ? 0 : sql.GetHashCode());
hashCode = hashCode * 23 + (type == null ? 0 : type.GetHashCode());
hashCode = hashCode * 23 + (connectionString == null ? 0 : connectionString.GetHashCode());
unchecked
{
hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this
hashCode = hashCode * 23 + (sql == null ? 0 : sql.GetHashCode());
hashCode = hashCode * 23 + (type == null ? 0 : type.GetHashCode());
hashCode = hashCode * 23 + (connectionString == null ? 0 : connectionString.GetHashCode());
}
}
public override bool Equals(object obj)
{