• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Length类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Length的典型用法代码示例。如果您正苦于以下问题:C# Length类的具体用法?C# Length怎么用?C# Length使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Length类属于命名空间,在下文中一共展示了Length类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IsValid

        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            var length = value.ToLength();

            if (length.HasValue)
                _h = _v = length.Value;
            else if (value is CSSValueList)
            {
                var values = (CSSValueList)value;

                if (values.Length != 2)
                    return false;

                var h = values[0].ToLength();
                var v = values[1].ToLength();

                if (!h.HasValue || !v.HasValue)
                    return false;

                _h = h.Value;
                _v = v.Value;
            }
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:32,代码来源:CSSBorderSpacingProperty.cs


示例2: attr

        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            Shape? shape = null,
            Length[] coords = null,
            string href = null,
            NoHref? nohref = null,
            Target target = null,
            string alt = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            char? accesskey = null,
            int? tabindex = null,
            string onfocus = null,
            string onblur = null
        )
        {
            Shape = shape;
            Coords = coords;
            Href = href;
            NoHref = nohref;
            Target = target;
            Alt = alt;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            AccessKey = accesskey;
            TabIndex = tabindex;
            OnFocus = onfocus;
            OnBlur = onblur;

            return this;
        }
开发者ID:bzure,项目名称:BSA.Net,代码行数:62,代码来源:TagArea.cs


示例3: Shape

 /// <summary>
 /// Creates a new shape value.
 /// </summary>
 /// <param name="top">The top position.</param>
 /// <param name="right">The right position.</param>
 /// <param name="bottom">The bottom position.</param>
 /// <param name="left">The left position.</param>
 public Shape(Length top, Length right, Length bottom, Length left)
 {
     _top = top;
     _right = right;
     _bottom = bottom;
     _left = left;
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:14,代码来源:Shape.cs


示例4: PredictorData

 public PredictorData(double distanceNominal, Length.Units unitNominal)
 {
     this.Distance = distanceNominal;
     this.Unit = unitNominal;
     result = new Dictionary<PredictionModel, TimePredictionResult>();
     source = null;
 }
开发者ID:jcboliveira,项目名称:gps-running,代码行数:7,代码来源:PredictorData.cs


示例5: Calculate

        /// <summary>
        /// Calculation method.
        /// </summary>
        /// <param name="chain">
        /// Source sequence.
        /// </param>
        /// <param name="link">
        /// Redundant parameter, not used in calculations.
        /// </param>
        /// <returns>
        /// Frequency of element in congeneric chain as <see cref="double"/>.
        /// </returns>
        public double Calculate(CongenericChain chain, Link link)
        {
            var count = new ElementsCount();
            var length = new Length();

            return count.Calculate(chain, link) / length.Calculate(chain, link);
        }
开发者ID:intervals-mining-lab,项目名称:libiada-core,代码行数:19,代码来源:Probability.cs


示例6: ToStandardMeasures_DoubleNoUnitConversion_ReturningNonConvertedStandardMeasures

 public void ToStandardMeasures_DoubleNoUnitConversion_ReturningNonConvertedStandardMeasures()
 {
     var measures = new[] { 1.0, 2.0, 3.0, -2.0 }.Cast<Length>();
     var expected = new Length(3.0);
     var actual = measures.ElementAt(2);
     MeasureAssert.MeasuresAreEqual(expected, actual);
 }
开发者ID:bjaminn,项目名称:csunits,代码行数:7,代码来源:MeasureEnumerableTests.cs


示例7: PaperMargins

 private PaperMargins(Length top, Length right, Length bottom, Length left)
 {
     _top = top;
     _right = right;
     _bottom = bottom;
     _left = left;
 }
开发者ID:Bossmojoman,项目名称:OpenHtmlToPdf,代码行数:7,代码来源:PaperMargins.cs


示例8: CSSBorderSpacingProperty

 internal CSSBorderSpacingProperty()
     : base(PropertyNames.BorderSpacing)
 {
     _inherited = true;
     _h = Length.Zero;
     _v = Length.Zero;
 }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:7,代码来源:CSSBorderSpacingProperty.cs


示例9: attr

        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            string longdesc = null,
            string name = null,
            string src = null,
            bool? frameborder = null,
            int? marginwidth = null,
            int? marginheight = null,
            Scrolling? scrolling = null,
            Length height = null,
            Length width = null  
        )
        {
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            LongDesc = longdesc;
            Name = name;
            Src = src;
            FrameBorder = frameborder;
            MarginWidth = marginwidth;
            MarginHeight = marginheight;
            Scrolling = scrolling;
            Height = height;
            Width = width;    

            return this;
        }
开发者ID:bzure,项目名称:BSA.Net,代码行数:34,代码来源:TagIFrame.cs


示例10: VerifyAllEnums

 public void VerifyAllEnums()
 {
     var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit);
     var angle = new Angle(1, AngleUnit.BaseUnit);
     var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit);
     var area = new Area(1, AreaUnit.BaseUnit);
     var density = new MassDensity(1, MassDensityUnit.BaseUnit);
     var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit);
     var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit);
     var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit);
     var energy = new Energy(1, EnergyUnit.BaseUnit);
     var force = new Force(1, ForceUnit.BaseUnit);
     var frequency = new Frequency(1, FrequencyUnit.BaseUnit);
     var jerk = new Jerk(1, JerkUnit.BaseUnit);
     var length = new Length(1, LengthUnit.BaseUnit);
     var mass = new Mass(1, MassUnit.BaseUnit);
     var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit);
     var momentum = new Momentum(1, MomentumUnit.BaseUnit);
     var numeric = new Numeric(1, NumericUnit.BaseUnit);
     var power = new Power(1, PowerUnit.BaseUnit);
     var pressure = new Pressure(1, PressureUnit.BaseUnit);
     var speed = new Speed(1, SpeedUnit.BaseUnit);
     var temperature = new Temperature(1, TemperatureUnit.BaseUnit);
     var time = new Time(1, TimeUnit.BaseUnit);
     var torque = new Torque(1, TorqueUnit.BaseUnit);
     var volume = new Volume(1, VolumeUnit.BaseUnit);
     var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit);
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:28,代码来源:EnumerationVerification.cs


示例11: hashCode

        public void hashCode()
        {
            Length l = new Length(10.1234, LengthType.mm);
            double d = 10.1234;
            for (int i = 0; i < 100; i++)
            {
                d = d / 7;
            }

            for (int i = 0; i < 100; i++)
            {
                d = d * 7;
            }
            Length l2 = new Length(d, LengthType.mm);

            Console.WriteLine(l.Value.ToString("n15") + " : " + l2.Value.ToString("n15"));

            Console.WriteLine(l.GetHashCode());

            Assert.IsTrue(l.Value - l2.Value > 0);
            Console.WriteLine(l.Value - l2.Value );
            Assert.IsTrue(l.Value != l2.Value);
            Assert.IsTrue(l == l2);
            Assert.IsTrue(l.GetHashCode() == l2.GetHashCode());
        }
开发者ID:hkiaipc,项目名称:C3,代码行数:25,代码来源:LengthTest.cs


示例12: Start

    private GameObject[] myBlocks; //arry to hold rferences to the blocks

    #endregion Fields

    #region Methods

    // Use this for initialization
    void Start()
    {
        //first initialize the bars array so you can insantiate prefabs
        Bars = new GameObject[3]{
            Resources.Load<GameObject>("Full_Block"),
            Resources.Load<GameObject>("Half_Block"),
            Resources.Load<GameObject>("Quarter_Block")
        };

        //if the height/width wasn't set, at least set it to 1 so you have something
        if(height == 0){height = 1;}
        if(width == 0){width = 1;}

        //if the block Lengths weren't selected then, at least make them quaters to see
        if(wBlock == Length.None){wBlock = Length.Quarter;}
        if(hBlock == Length.None){wBlock = Length.Quarter;}

        myBlocks = new GameObject[(2*(width+height))];

        switch(wBlock){
        case Length.Full:
            for(int i = 0; i<width; i++){

            }break;
        case Length.Half:
            for(int i = 0; i<width; i++){

            }break;
        case Length.Quarter:
            for(int i = 0; i<width; i++){

            }break;
        }
    }
开发者ID:vmichial,项目名称:PacRift,代码行数:41,代码来源:Frame.cs


示例13: doit

        public static void doit()
        {
            new LengthTest().hashCode();

            Length l = new Length(10.1234, LengthType.mm);
            double d = 10.1234;
            for (int i = 0; i < 100; i++)
            {
                d = d / 7;
            }

            for (int i = 0; i < 100; i++)
            {
                d = d * 7;
            }
            Length l2 = new Length(d, LengthType.cm);
            Console.WriteLine(l);
            Console.WriteLine(new Length());

            Console.WriteLine(l.ToCM());
            Console.WriteLine(l.ToKM());
            Console.WriteLine(l.ToM());

            Console.WriteLine(new Length(1, LengthType.km).ToCM());
            //Console.WriteLine(l2.ToString("n0"));

            Console.WriteLine(l2.Value);
            Console.WriteLine(l.GetHashCode() + " " + l2.GetHashCode());
            Console.WriteLine(l.Equals(l2));
        }
开发者ID:hkiaipc,项目名称:C3,代码行数:30,代码来源:LengthTest.cs


示例14: Datum

 public Datum(DateTime time, Latitude latitude, Longitude longitude, Length altitude = null, Speed speed = null, Heading heading = null)
 {
     _time = time;
     _location = new GeoPosition(latitude, longitude, altitude);
     _speed = speed;
     _heading = heading;
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:7,代码来源:GeoTrail.cs


示例15: OpAddition

 public void OpAddition()
 {
     var length1 = new Length(5000, LengthUnit.Meter);
     var length2 = new Length(2, LengthUnit.Kilometer);
     var expected = new Length(7000, LengthUnit.Meter);
     (length1 + length2).ShouldEqual(expected);
     (length2 + length1).ShouldEqual(expected);
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:8,代码来源:LengthOperators.cs


示例16: Divide_DivideVolumeAndLength_ReturnsArea

 public void Divide_DivideVolumeAndLength_ReturnsArea()
 {
     var expected = new Area(4.0);
     var numerator = new Volume(8.0);
     var denominator = new Length(200.0, Length.CentiMeter);
     Area actual; ArithmeticOperations.Divide(numerator, denominator, out actual);
     MeasureAssert.MeasuresAreEqual(expected, actual);
 }
开发者ID:bjaminn,项目名称:csunits,代码行数:8,代码来源:ArithmeticOperationsTests.cs


示例17: Times_MultiplyAreaAndLength_ReturnsVolume

 public void Times_MultiplyAreaAndLength_ReturnsVolume()
 {
     var expected = new Volume(6.0);
     var lhs = new Area(2.0);
     var rhs = new Length(3.0);
     Volume actual; ArithmeticOperations.Times(lhs, rhs, out actual);
     MeasureAssert.MeasuresAreEqual(expected, actual);
 }
开发者ID:bjaminn,项目名称:csunits,代码行数:8,代码来源:ArithmeticOperationsTests.cs


示例18: CSSBorderWidthProperty

 internal CSSBorderWidthProperty()
     : base(PropertyNames.BorderWidth)
 {
     _inherited = false;
     _top = Length.Medium;
     _right = Length.Medium;
     _bottom = Length.Medium;
     _left = Length.Medium;
 }
开发者ID:jogibear9988,项目名称:AngleSharp,代码行数:9,代码来源:CSSBorderWidthProperty.cs


示例19: Shadow

 /// <summary>
 /// Creates a new CSS shadow.
 /// </summary>
 /// <param name="inset">If the shadow is an inset.</param>
 /// <param name="offsetX">The x-coordinate offset.</param>
 /// <param name="offsetY">The y-coordinate offset.</param>
 /// <param name="blurRadius">The blur radius of the shadow.</param>
 /// <param name="spreadRadius">The spread radius of the shadow.</param>
 /// <param name="color">The color of the shadow.</param>
 public Shadow(Boolean inset, Length offsetX, Length offsetY, Length blurRadius, Length spreadRadius, Color color)
 {
     _inset = inset;
     _offsetX = offsetX;
     _offsetY = offsetY;
     _blurRadius = blurRadius;
     _spreadRadius = spreadRadius;
     _color = color;
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:18,代码来源:Shadow.cs


示例20: Box2

        /// <summary>Create a <see cref="Box2"/> by providing minimum and maximum extents.</summary>
        public Box2(
			 Length minX ,  Length minY ,
			 Length maxX ,  Length maxY )
        {
            Min.X = minX;
                Max.X = maxX;
                            Min.Y = minY;
                Max.Y = maxY;
        }
开发者ID:Burton-Radons,项目名称:Alexandria,代码行数:10,代码来源:Box1.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Letter类代码示例发布时间:2022-05-24
下一篇:
C# Leg类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap