GetHashCode() 공개 메소드

public GetHashCode ( ) : int
리턴 int
예제 #1
0
		public void Equals_Subset ()
		{
			ApplicationId id1 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, defaultCulture);
			ApplicationId id2 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, null, defaultCulture);
			Assert.IsFalse (id1.Equals (id2), "Equals-A1");
			Assert.IsFalse (id2.Equals (id1), "Equals-A2");
			// would have expected IsFalse
			Assert.IsTrue (id1.GetHashCode () == id2.GetHashCode (), "GetHashCode-A");

			ApplicationId id3 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, null);
			Assert.IsFalse (id1.Equals (id3), "Equals-B1");
			Assert.IsFalse (id3.Equals (id1), "Equals-B2");
			// would have expected IsFalse
			Assert.IsTrue (id1.GetHashCode () == id3.GetHashCode (), "GetHashCode-B");
		}
예제 #2
0
		public void Equals ()
		{
			ApplicationId id1 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, defaultCulture);
			ApplicationId id2 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, defaultCulture);
			Assert.IsTrue (id1.Equals (id2), "Equals-1");
			Assert.IsTrue (id2.Equals (id1), "Equals-2");
			Assert.AreEqual (id1.GetHashCode (), id2.GetHashCode (), "GetHashCode");
		}