From 8ad6ebed97ffd439fadd97502a581b9fc1131884 Mon Sep 17 00:00:00 2001 From: mgravell Date: Fri, 22 Apr 2011 13:04:31 +0100 Subject: [PATCH] hashcode calc should be unchecked --- Dapper/SqlMapper.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dapper/SqlMapper.cs b/Dapper/SqlMapper.cs index 125e7916..3df858b6 100644 --- a/Dapper/SqlMapper.cs +++ b/Dapper/SqlMapper.cs @@ -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) {