开发者

Dictionary GetHashCode Inconsistant

i am using this hash for 开发者_Go百科data retrival, but the data retrival is very uniform sometimes i get data under 200 millisecs and sometimes its over a sec.. can any give me some suggestions

public override int GetHashCode()

{

return   
this.DomainID.GetHashCode() *(851) *    
(this.A.HasValue ? this.A.GetHashCode() : 1) * (851) *    
((this.C != null ? this.C.ToLower().GetHashCode() : 1)^     
(this.Ap != null ? this.Ap.ToLower().GetHashCode() : 1) * (851) *    
(this.Ks != null ? this.Ks.ToLower().GetHashCode() : 1)) *  
(this.Le != null ? Le.ToLower().GetHashCode() : 1);

}


The code itself looks alright at a first glance, but there is a lot of things that we don't see. What types are DomainID, A, C, Ap, Ks and Le for example? And how are their GetHashCode-methods implemented?


It might suggest that one of your conditions is slower than the rest. Maybe the ToLower() is an expensive call dependant on which values in the the this are null

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜