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


C# System.Linq.Mutate方法代码示例

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


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

示例1: TestReact

    public void TestReact()
    {
      var f = new LowerBoundFunction<int, Int32Order>();
      var x = new[] {1, 1, 3, 5, 6, 9}.ToList();

      Assert.That(f.React(3, x.ToLog(Δ1.Empty), 4.ToLog(false)), Is.EqualTo(3.ToLog(false)));
      Assert.That(f.React(3, x.ToLog(Δ1.Empty), 4.ToLog(true)), Is.EqualTo(3.ToLog(false)));
      Assert.That(f.React(3, x.ToLog(Δ1.Empty), 5.ToLog(true)), Is.EqualTo(3.ToLog(false)));
      Assert.That(f.React(3, x.ToLog(Δ1.Empty), 3.ToLog(true)), Is.EqualTo(2.ToLog(true)));
      Assert.That(f.React(3, x.Mutate(Expressions.Numbers(5).ToSub(), (key, j) => 20), 4.ToLog(false)), Is.EqualTo(3.ToLog(false)));
      Assert.That(f.React(3, x.Mutate(Expressions.Numbers(3).ToSub(), (key, j) => 3), 4.ToLog(false)), Is.EqualTo(4.ToLog(true)));
    }
开发者ID:rbec,项目名称:malbec,代码行数:12,代码来源:TestLowerBoundFunction.cs

示例2: DrawRectangleOutline

        /// <summary>
        ///   Draws a hollow rectangle whose center is position, of width lineWidth (default 1px, does not exceed width)
        /// </summary>
        /// <param name="batch"> SpriteBatch for drawing </param>
        /// <param name="position"> Center of the rectangle </param>
        /// <param name="color"> Color of the rectangle </param>
        /// <param name="dimensions"> Dimensions of the rectangle </param>
        /// <param name="rotation"> Rotation in radians about the center </param>
        /// <param name="lineWidth"> Width in pixels of the line </param>
        public static void DrawRectangleOutline(SpriteBatch batch, Vector2 position, Color color, Vector2 dimensions,
                                                float rotation, float lineWidth = 1)
        {
            if (!CanDraw) return;
            var dim2 = dimensions/2;
            var corners = new[]
                              {
                                  position + new Vector2(-dim2.X + lineWidth, -dim2.Y + lineWidth),
                                  position + new Vector2(-dim2.X + lineWidth, dim2.Y - lineWidth),
                                  position + new Vector2(dim2.X - lineWidth, dim2.Y - lineWidth),
                                  position + new Vector2(dim2.X - lineWidth, -dim2.Y + lineWidth),
                                  position + new Vector2(-dim2.X + lineWidth, -dim2.Y + lineWidth)
                              };

            corners = corners.Mutate(v => v.RotateAbout(position, rotation)).ToArray();

            var scale = new Vector2(0, lineWidth);
            for (int i = 0; i < 4; i++)
            {
                var segment = (corners[i + 1] - corners[i]);
                scale.X = segment.Length() + lineWidth;
                batch.Draw(pixel1x1, corners[i], null, color, (float) segment.AsAngle(), Vector2.Zero, scale,
                           SpriteEffects.None, 0);
            }
        }
开发者ID:numberoverzero,项目名称:XNA-Engine,代码行数:34,代码来源:BasicShapeRenderer.cs


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