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


C# Color.GetHashCode方法代碼示例

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


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

示例1: Test_Equals

        public void Test_Equals()
        {
            var a = new Color (1, 2, 3, 4);
            var b = new Color (1, 2, 3, 4);
            var c = new Color (1, 2, 3, 0);

            Assert.IsTrue (a.Equals (b));
            Assert.IsTrue (a == b);
            Assert.AreEqual (a.GetHashCode (), b.GetHashCode ());

            Assert.IsFalse (a.Equals (c));
            Assert.IsFalse (a == c);
            Assert.AreNotEqual (a.GetHashCode (), c.GetHashCode ());
        }
開發者ID:weimingtom,項目名稱:erica,代碼行數:14,代碼來源:TestColor.cs

示例2: TestColorModel

 public void TestColorModel()
 {
     var c1 = new Color();
     Assert.AreEqual(c1, default(Color));
     Assert.IsTrue(c1 == default(Color));
     Assert.IsFalse(c1 != default(Color));
     Assert.IsTrue(((object)c1).Equals((object)default(Color)));
     Assert.AreEqual("00000000", c1.ToString());
     var c2 = new Color(255, 0, 0, 0);
     Assert.AreEqual(c2.R, 255);
     Assert.AreEqual(c2.G, 0);
     Assert.AreEqual(c2.B, 0);
     Assert.AreEqual(c2.A, 0);
     Assert.AreEqual(Color.Red.ToString(), c2.ToString());
     Assert.AreEqual(Color.Red.GetHashCode(), c2.GetHashCode());
 }
開發者ID:ChaosPandion,項目名稱:MData,代碼行數:16,代碼來源:ColorTests.cs

示例3: WriteColor

 private void WriteColor(string fieldName, Color value)
 {
     var bytes = BitConverter.GetBytes(value.GetHashCode());
     var offset = Marshal.OffsetOf(typeof(DevDesc), fieldName).ToInt32();
     Marshal.Copy(bytes, 0, IntPtr.Add(handle, offset), bytes.Length);
 }
開發者ID:tjaskula,項目名稱:rdotnet,代碼行數:6,代碼來源:DeviceDescription.cs

示例4: TestHashCode

		public void TestHashCode ()
		{
			var color1 = new Color (0.1);
			var color2 = new Color (0.1);

			Assert.True (color1.GetHashCode () == color2.GetHashCode ());
			color2 = Color.FromHsla (color2.Hue, color2.Saturation, .5);

			Assert.False (color1.GetHashCode () == color2.GetHashCode ());
		}
開發者ID:Costo,項目名稱:Xamarin.Forms,代碼行數:10,代碼來源:ColorUnitTests.cs


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