本文整理汇总了C#中Maybe.Or方法的典型用法代码示例。如果您正苦于以下问题:C# Maybe.Or方法的具体用法?C# Maybe.Or怎么用?C# Maybe.Or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maybe
的用法示例。
在下文中一共展示了Maybe.Or方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryConstructHeader
protected override Maybe<Header> TryConstructHeader(
Maybe<int> width,
Maybe<int> height,
Maybe<Ratio> framerate,
Maybe<Ratio> pixelAspectRatio,
Maybe<Interlacing> interlacing,
Maybe<ColorSpace> colorspace,
IEnumerable<string> comments
)
{
int inputWidth = width.OrElse(_fileLevelHeader.Width);
int inputHeight = height.OrElse(_fileLevelHeader.Height);
Ratio inputFramerate = framerate.OrElse(_fileLevelHeader.Framerate);
Maybe<Ratio> inputPixelAspectRatio = pixelAspectRatio.Or(_fileLevelHeader.PixelAspectRatio);
Maybe<Interlacing> inputInterlacing = interlacing.Or(_fileLevelHeader.Interlacing);
Maybe<ColorSpace> inputColorSpace = colorspace.Or(_fileLevelHeader.ColorSpace);
IEnumerable<string> inputComments = _fileLevelHeader.Comments.Concat(comments);
return (new FrameHeader(
inputWidth,
inputHeight,
inputFramerate,
inputPixelAspectRatio,
inputColorSpace,
inputInterlacing,
inputComments) as Header).ToMaybe();
}
示例2: Or_WhenFirstAndSecondIsConstructedWithZeroElements_ReturnsSecond
public void Or_WhenFirstAndSecondIsConstructedWithZeroElements_ReturnsSecond()
{
// ARRANGE
var maybe1 = new Maybe<string>();
var maybe2 = new Maybe<string>();
// ACT
var actual = maybe1.Or(maybe2);
// ASSERT
Assert.AreNotSame(maybe1, actual);
Assert.AreSame(maybe2, actual);
}
示例3: Or_WhenFirstAndSecondIsConstructedWithOneElement_ReturnsFirst
public void Or_WhenFirstAndSecondIsConstructedWithOneElement_ReturnsFirst()
{
// ARRANGE
var maybe1 = new Maybe<string>("Bill");
var maybe2 = new Maybe<string>("Ted");
// ACT
var actual = maybe1.Or(maybe2);
// ASSERT
Assert.AreSame(maybe1, actual);
Assert.AreNotSame(maybe2, actual);
}