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


C# Maybe.Or方法代码示例

本文整理汇总了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();
        }
开发者ID:helios2k6,项目名称:MobileImageProcessor,代码行数:27,代码来源:FrameHeaderParser.cs

示例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);
        }
开发者ID:dibley1973,项目名称:StoredProcedureFramework,代码行数:13,代码来源:MaybeOfTTests.cs

示例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);
        }
开发者ID:dibley1973,项目名称:StoredProcedureFramework,代码行数:13,代码来源:MaybeOfTTests.cs


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