프로젝트 (회사 코드)를 검사했을 때. 나는 이것을 보았다 :C#에서 Connection.GetHashCode가 사용되는 이유는 무엇입니까?
public override int GetHashCode()
{
unchecked
{
int result = 17;
result = result * 23 + ((connection != null) ? this.connection.GetHashCode() : 0);
return result;
}
}
나는 실제로 GetHashCode()
를 처음 보았다. 나는 그것에 대해 조금 달렸다. 그러나 나는이 코드 라인과 연결에 왜 그것을 사용했는지 이해할 수 없다.
특별한 이유가 있습니까? 연결에 getHashCode를 사용하는 논리는 무엇입니까?
감사합니다.
마법 번호의 목적은 무엇입니까? 완전히 무의미한 것처럼 보입니다. – Alex
http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/ –