当前位置: 首页>>代码示例>>C#>>正文


C# Union.Equals方法代码示例

本文整理汇总了C#中Union.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Union.Equals方法的具体用法?C# Union.Equals怎么用?C# Union.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Union的用法示例。


在下文中一共展示了Union.Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DifferentT4Values_ArentEqual

 public void DifferentT4Values_ArentEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Animals.Cat);
     var b = new Union<int, string, Colors, Animals>(Animals.Cow);
     IsFalse(a.Equals(b));
     IsFalse(a == b);
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:7,代码来源:UnionT1T2T3T4EqualityTests.cs

示例2: DifferentT3Values_ArentEqual

 public void DifferentT3Values_ArentEqual()
 {
     var a = new Union<int, string, Colors>(Colors.Blue);
     var b = new Union<int, string, Colors>(Colors.Green);
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
开发者ID:martijnhoekstra,项目名称:SuccincT,代码行数:7,代码来源:UnionT1T2T3EqualityTests.cs

示例3: DifferentT2Values_ArentEqual

 public void DifferentT2Values_ArentEqual()
 {
     var a = new Union<int, string, Colors>("abc");
     var b = new Union<int, string, Colors>("def");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
开发者ID:martijnhoekstra,项目名称:SuccincT,代码行数:7,代码来源:UnionT1T2T3EqualityTests.cs

示例4: ComparingT2ValueWithNull_ResultsInNotEqual

 public void ComparingT2ValueWithNull_ResultsInNotEqual()
 {
     var a = new Union<int, string>(null);
     IsFalse(a.Equals(null));
     IsTrue(a != null);
     IsTrue(null != a);
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:7,代码来源:UnionT1T2EqualityTests.cs

示例5: DifferentT2Values_ArentEqual

 public void DifferentT2Values_ArentEqual()
 {
     var a = new Union<int, string>("a");
     var b = new Union<int, string>("b");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:7,代码来源:UnionT1T2EqualityTests.cs

示例6: DifferentT3Values_ArentEqual

 public void DifferentT3Values_ArentEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Colors.Blue);
     var b = new Union<int, string, Colors, Animals>(Colors.Red);
     IsFalse(a.Equals(b));
     IsFalse(a == b);
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:7,代码来源:UnionT1T2T3T4EqualityTests.cs

示例7: DifferentT1T3Values_AreNotEqualAndHaveDifferentHashCodes

 public void DifferentT1T3Values_AreNotEqualAndHaveDifferentHashCodes()
 {
     var a = new Union<int, string, Colors>(0);
     var b = new Union<int, string, Colors>(Colors.Green);
     IsFalse(a.Equals(b));
     IsTrue(a != b);
     AreNotEqual(a.GetHashCode(), b.GetHashCode());
 }
开发者ID:martijnhoekstra,项目名称:SuccincT,代码行数:8,代码来源:UnionT1T2T3EqualityTests.cs

示例8: SameT3Values_AreEqualAndHaveSameHashCode

 public void SameT3Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string, Colors>(Colors.Blue);
     var b = new Union<int, string, Colors>(Colors.Blue);
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
开发者ID:martijnhoekstra,项目名称:SuccincT,代码行数:8,代码来源:UnionT1T2T3EqualityTests.cs

示例9: DifferentValues_AreNotEqualAndHaveDifferentHashCodes

 public void DifferentValues_AreNotEqualAndHaveDifferentHashCodes()
 {
     var a = new Union<int, string>(0);
     var b = new Union<int, string>("1234");
     IsFalse(a.Equals(b));
     IsTrue(a != b);
     AreNotEqual(a.GetHashCode(), b.GetHashCode());
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:8,代码来源:UnionT1T2EqualityTests.cs

示例10: SameT2Values_AreEqualAndHaveSameHashCode

 public void SameT2Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string>("1234");
     var b = new Union<int, string>("1234");
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:8,代码来源:UnionT1T2EqualityTests.cs

示例11: SameT4Values_AreEqualAndHaveSameHashCode

 public void SameT4Values_AreEqualAndHaveSameHashCode()
 {
     var a = new Union<int, string, Colors, Animals>(Animals.Cat);
     var b = new Union<int, string, Colors, Animals>(Animals.Cat);
     IsTrue(a.Equals(b));
     IsTrue(a == b);
     AreEqual(a.GetHashCode(), b.GetHashCode());
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:8,代码来源:UnionT1T2T3T4EqualityTests.cs

示例12: UnionIsNotEqualToStructurallyInequalUnion

 public void UnionIsNotEqualToStructurallyInequalUnion()
 {
     Union<Item, DataUnit> union1 = new Union<Item, DataUnit>.Case1(new Item(42));
     Union<Item, DataUnit> union2 = new Union<Item, DataUnit>.Case2(new DataUnit(42));
     Assert.False(union1.Equals(union2));
     Assert.False(union2.Equals(union1));
     Assert.True(union1 != union2);
     Assert.True(union2 != union1);
 }
开发者ID:danslapman,项目名称:PatternMatching,代码行数:9,代码来源:UnionStructuralEqualityTests.cs

示例13: UnionEqualsSameUnion

 public void UnionEqualsSameUnion()
 {
     Union<Item, DataUnit> union1 = new Union<Item, DataUnit>.Case1(new Item(42));
     Union<Item, DataUnit> union2 = new Union<Item, DataUnit>.Case1(new Item(42));
     Assert.True(union1.Equals(union2));
     Assert.True(union2.Equals(union1));
     Assert.True(union1 == union2);
     Assert.True(union2 == union1);
 }
开发者ID:danslapman,项目名称:PatternMatching,代码行数:9,代码来源:UnionStructuralEqualityTests.cs

示例14: UnionEqualsItself

 public void UnionEqualsItself()
 {
     Union<Item, DataUnit> union = new Union<Item, DataUnit>.Case1(new Item(42));
     Assert.True(union.Equals(union));
 }
开发者ID:danslapman,项目名称:PatternMatching,代码行数:5,代码来源:UnionStructuralEqualityTests.cs

示例15: ComparingT4ValueWithNull_ResultsInNotEqual

 public void ComparingT4ValueWithNull_ResultsInNotEqual()
 {
     var a = new Union<int, string, Colors, Animals>(Animals.Dog);
     IsFalse(a.Equals(null));
     IsTrue(a != null);
     IsTrue(null != a);
 }
开发者ID:chamook,项目名称:SuccincT,代码行数:7,代码来源:UnionT1T2T3T4EqualityTests.cs


注:本文中的Union.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。