當前位置: 首頁>>代碼示例>>C#>>正文


C# StrongNamePublicKeyBlob.GetHashCode方法代碼示例

本文整理匯總了C#中System.Security.Permissions.StrongNamePublicKeyBlob.GetHashCode方法的典型用法代碼示例。如果您正苦於以下問題:C# StrongNamePublicKeyBlob.GetHashCode方法的具體用法?C# StrongNamePublicKeyBlob.GetHashCode怎麽用?C# StrongNamePublicKeyBlob.GetHashCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Security.Permissions.StrongNamePublicKeyBlob的用法示例。


在下文中一共展示了StrongNamePublicKeyBlob.GetHashCode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PublicKey

	public void PublicKey () 
	{
		StrongNamePublicKeyBlob snpkb = new StrongNamePublicKeyBlob (pk);
		Assert.IsTrue (snpkb.Equals (snpkb), "Equals(Self)");
		Assert.IsFalse (snpkb.Equals (null), "Equals(null)");
		Assert.AreEqual ("00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB", snpkb.ToString (), "ToString(pk)");

		StrongNamePublicKeyBlob snpkb2 = new StrongNamePublicKeyBlob (pk);
		Assert.IsTrue (snpkb.Equals (snpkb2), "Equals()-true");
		StrongNamePublicKeyBlob snpkb3 = new StrongNamePublicKeyBlob (bad);
		Assert.IsFalse (snpkb.Equals (snpkb3), "Equals()-false");

		// non standard get hash code - why ???
		Assert.AreEqual (snpkb2.GetHashCode (), snpkb.GetHashCode (), "GetHashCode-0");
#if NET_2_0
		// the first 4 bytes has code has been fixed in 2.0 beta 1
#elif NET_1_1
		// It seems to be the first four bytes of the public key data
		// which seems like non sense as all valid public key will have the same header ?
		Assert.AreEqual (2359296, snpkb.GetHashCode (), "GetHashCode-1");
		Assert.AreEqual (2359296, snpkb2.GetHashCode (), "GetHashCode-2");
		Assert.AreEqual (2989, snpkb3.GetHashCode (), "GetHashCode-3");
		byte[] header = { 0x00, 0x24, 0x00, 0x00 };
		StrongNamePublicKeyBlob snpkb4 = new StrongNamePublicKeyBlob (header);
		Assert.AreEqual (2359296, snpkb4.GetHashCode (), "GetHashCode-4");
#endif
	}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:27,代碼來源:StrongNamePublicKeyBlobTest.cs


注:本文中的System.Security.Permissions.StrongNamePublicKeyBlob.GetHashCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。