本文整理汇总了C#中Maybe.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Maybe.Equals方法的具体用法?C# Maybe.Equals怎么用?C# Maybe.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maybe
的用法示例。
在下文中一共展示了Maybe.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Maybe_Equals_OnlyLeftHasValueNotEqual
public void Maybe_Equals_OnlyLeftHasValueNotEqual()
{
var a = new Maybe<string>("a");
var b = Maybe<string>.NoValue;
Assert.IsFalse(a.Equals(b));
}
示例2: Maybe_Equals_BothHaveSameValueIsEqual
public void Maybe_Equals_BothHaveSameValueIsEqual()
{
var a = new Maybe<string>("a");
var b = new Maybe<string>("a");
Assert.IsTrue(a.Equals(b));
}
示例3: Maybe_Equals_SameValueAreEqual
public void Maybe_Equals_SameValueAreEqual()
{
var val = "Value";
var a = new Maybe<string>(val);
object b = new Maybe<string>(val);
Assert.IsTrue(a.Equals(b));
}
示例4: BoxedMaybeEqualsBehavesCorrectly
public void BoxedMaybeEqualsBehavesCorrectly()
{
object left = new Maybe<int>(7);
object right = new Maybe<int>(7);
Assert.IsTrue(left.Equals(right));
Assert.IsFalse(left.Equals(null));
Assert.IsFalse(left.Equals(7));
}
示例5: Maybe_Equals_NullIsNotEqual
public void Maybe_Equals_NullIsNotEqual()
{
object a = null;
var b = new Maybe<string>("b");
Assert.IsFalse(b.Equals(a));
}