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

C# Mass类代码示例

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

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



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

示例1: MassBothInequality

        public void MassBothInequality()
        {
            Mass m1 = new Mass(524.342);
            Mass m2 = new Mass(524.343);

            Assert.AreNotEqual(m1, m2);
        }
开发者ID:B-Rich,项目名称:CSMSL,代码行数:7,代码来源:MassTestFixture.cs


示例2: 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


示例3: Test_this

		public void Test_this (double massValue, double secondValue, double expectedValue)
		{
			var _mass = new Mass (MeasurementSystem.InternationalSystemOfUnits, massValue);
			var _second = new Mass (MeasurementSystem.InternationalSystemOfUnits, secondValue);
			var _sum = _mass + _second;
			Assert.AreEqual (expectedValue, _sum [MeasurementSystem.InternationalSystemOfUnits]);
		}
开发者ID:vladimir-a-kozhevnikov,项目名称:VKS.Commons,代码行数:7,代码来源:MassTests.cs


示例4: ConvertToSi

 public void ConvertToSi(Mass m, string dimension)
 {
     if (dimension != "kg")
     {
         if (dimension == "t")
         {
             m.Value *= 1000;
         }
         else if (dimension == "sl")
         {
             m.Value *= 14.6;
         }
         else if (dimension == "Ib")
         {
             m.Value *= 0.45;
         }
         else if (dimension == "g")
         {
             m.Value /= 1000;
         }
         else if (dimension == "mg")
         {
             m.Value /= 1000000000;
         }
         else
         {
             throw new IncorrectDimensionOfMassException();
         }
     }
 }
开发者ID:alena-butkevich,项目名称:OOP,代码行数:30,代码来源:ConverterForMass.cs


示例5: MassEquality

        public void MassEquality()
        {
            Mass m1 = new Mass(524.342);
            Mass m2 = new Mass(524.342);

            Assert.AreEqual(m1, m2);
        }
开发者ID:B-Rich,项目名称:CSMSL,代码行数:7,代码来源:MassTestFixture.cs


示例6: can_use_mass_volume_constructor

 [Test] public void can_use_mass_volume_constructor() {
     Mass m = new Mass(10, MassUnit.Pounds);
     Volume v = new Volume(2, VolumeUnit.Gallons);
     var d = new Density(m, v);
     d.Mass.ShouldEqual(m);
     d.Volume.ShouldEqual(v);
 }
开发者ID:togakangaroo,项目名称:GIM.Quantities,代码行数:7,代码来源:When_creating_density.cs


示例7: MassObjectToMzNegativeCharge

        public void MassObjectToMzNegativeCharge()
        {
            Mass m1 = new Mass(1000);
            double mz = m1.ToMz(-2);

            Assert.AreEqual(498.99272353318798, mz);
        }
开发者ID:B-Rich,项目名称:CSMSL,代码行数:7,代码来源:MassTestFixture.cs


示例8: MassMonoisotopicInequality

        public void MassMonoisotopicInequality()
        {
            Mass m1 = new Mass(524.342);
            Mass m2 = new Mass(524.343);

            Assert.AreNotEqual(m1, m2);
        }
开发者ID:B-Rich,项目名称:CSMSL,代码行数:7,代码来源:MassTestFixture.cs


示例9: ConstructorIMassRefInequality

        public void ConstructorIMassRefInequality()
        {
            IMass m = new Mass(524.342);
            Mass m2 = new Mass(m);

            Assert.AreNotSame(m, m2);
        }
开发者ID:B-Rich,项目名称:CSMSL,代码行数:7,代码来源:MassTestFixture.cs


示例10: ConstructorIMass

        public void ConstructorIMass()
        {
            IMass m = new Mass(524.342);
            Mass m2 = new Mass(m);

            Assert.AreEqual(m, m2);
        }
开发者ID:B-Rich,项目名称:CSMSL,代码行数:7,代码来源:MassTestFixture.cs


示例11: OpAddition

 public void OpAddition()
 {
     var mass1 = new Mass(2000, MassUnit.Gram);
     var mass2 = new Mass(1, MassUnit.Kilogram);
     var expected = new Mass(3000, MassUnit.Gram);
     (mass1 + mass2).ShouldEqual(expected);
     (mass2 + mass1).ShouldEqual(expected);
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:8,代码来源:MassOperators.cs


示例12: Convert

 public Mass Convert(Mass from, MassUnit to) {
     if (from.Unit.Equals(to))
         return new Mass(from.Amount, to);
     var tfs = new FromToConversion(from.Unit, to);
     if(!_knownConversions.ContainsKey(tfs))
         throw new NotImplementedException("This conversion has not yet been implemented");
     return new Mass(from.Amount * _knownConversions[tfs], to);
 }
开发者ID:togakangaroo,项目名称:GIM.Quantities,代码行数:8,代码来源:MassConversion.cs


示例13: pictureBox1_MouseClick

 private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
 {
     Mass m = new Mass(e.Location.X, e.Location.Y, Int32.Parse(textBox1.Text));
     lista.Add(m);
     reloadPicture();
     //tu bedzie reloadPicture() z wyliczeniem kropek i potem linii
     reloadPotencjal();
     pictureBox1.Refresh();
     reloadBox();
 }
开发者ID:Robikos,项目名称:Old-Portfolio,代码行数:10,代码来源:Form1.cs


示例14: OpInverseEquals

 public void OpInverseEquals()
 {
     var mass1 = new Mass(3000, MassUnit.Gram);
     var mass2 = new Mass(3, MassUnit.Kilogram);
     var mass3 = new Mass(4, MassUnit.Kilogram);
     (mass1 != mass2).ShouldBeFalse();
     (mass2 != mass1).ShouldBeFalse();
     (mass1 != mass3).ShouldBeTrue();
     (mass3 != mass1).ShouldBeTrue();
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:10,代码来源:MassOperators.cs


示例15: OpGreaterThanOrEqual

 public void OpGreaterThanOrEqual()
 {
     var mass1 = new Mass(3000, MassUnit.Gram);
     var mass2 = new Mass(3, MassUnit.Kilogram);
     var mass3 = new Mass(4, MassUnit.Kilogram);
     (mass1 >= mass3).ShouldBeFalse();
     (mass3 >= mass1).ShouldBeTrue();
     (mass1 >= mass2).ShouldBeTrue();
     (mass2 >= mass1).ShouldBeTrue();
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:10,代码来源:MassOperators.cs


示例16: OpDivision

        public void OpDivision()
        {
            var mass1 = new Mass(2000, MassUnit.Gram);
            var mass2 = new Mass(2, MassUnit.Kilogram);
            (mass1 / mass2).ShouldBeWithinEpsilonOf(1);
            (mass2 / mass1).ShouldBeWithinEpsilonOf(1);

            (mass1 / 2).ShouldEqual(new Mass(1000, MassUnit.Gram));
            (mass2 / 2).ShouldEqual(new Mass(1, MassUnit.Kilogram));
        }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:10,代码来源:MassOperators.cs


示例17: Start

 public void Start()
 {
     m_hb=this;
     m_AS=(AudioSource)gameObject.GetComponent<AudioSource>();
     m_PS=(ParticleSystem)gameObject.GetComponent<ParticleSystem>();
     m_mass=(Mass)gameObject.GetComponent<Mass>();
     m_curMax=m_baseMax;
     m_curRate=m_baseEmissionRate;
     sm_planetBonus=0;
     sm_score=0;
 }
开发者ID:LostJourneyer,项目名称:Universal-Allergies,代码行数:11,代码来源:HeartBeat.cs


示例18: ApplyGravity

 public static Vector3 ApplyGravity(Mass body)
 {
     Vector3 totalForces = new Vector3 ();
     foreach (Mass m in m_Gravity.m_masses) {
         if (body != m) {
             Vector3 toVec = m.transform.position - body.transform.position;
             totalForces =totalForces+ Mathf.Sqrt(Mathf.Min(toVec.sqrMagnitude,Mathf.Pow(10,20))*(body.rigidbody.mass+m.rigidbody.mass))*toVec.normalized;
     //				Debug.Log(m.name);
     //				Debug.Log(totalForces+"+ Mathf.Sqrt("+toVec.sqrMagnitude+"*("+body.rigidbody.mass+"+"+m.rigidbody.mass+"))*"+toVec.normalized);
         }
     }
     //		Debug.Log(body.name+totalForces);
     return totalForces;
 }
开发者ID:LostJourneyer,项目名称:Universal-Allergies,代码行数:14,代码来源:GravityManager.cs


示例19: Main

        private static void Main(string[] args)
        {
            var vehicleMass = new Mass(2500, MassUnit.Pounds);
            var startSpeed = new Speed(72, SpeedUnit.MilesPerHour);
            var endSpeed = new Speed(0, SpeedUnit.MilesPerHour);
            var stoppingDistance = new Length(1234, LengthUnit.Foot);
            Acceleration deceleration = ((endSpeed * endSpeed) - (startSpeed * startSpeed)) / (2 * stoppingDistance);
            Force stoppingForceRequired = vehicleMass * deceleration;

            Console.WriteLine("The stopping force required is:");
            Console.WriteLine("\t{0}", stoppingForceRequired.ToString(ForceUnit.Newtons, 3));
            Console.WriteLine("\t{0}", stoppingForceRequired.ToString(ForceUnit.KilogramForce, 3));
            Console.WriteLine("\t{0}", stoppingForceRequired.ToString(ForceUnit.PoundForce, 3));
            Console.ReadLine();
        }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:15,代码来源:Program.cs


示例20: OpEquals

 public void OpEquals()
 {
     var mass1 = new Mass(3000, MassUnit.Gram);
     var mass2 = new Mass(3, MassUnit.Kilogram);
     var mass3 = new Mass(4, MassUnit.Kilogram);
     (mass1 == mass2).ShouldBeTrue();
     (mass2 == mass1).ShouldBeTrue();
     (mass1 == mass3).ShouldBeFalse();
     (mass3 == mass1).ShouldBeFalse();
     mass1.Equals(mass2)
          .ShouldBeTrue();
     mass1.Equals((object)mass2)
          .ShouldBeTrue();
     mass2.Equals(mass1)
          .ShouldBeTrue();
     mass2.Equals((object)mass1)
          .ShouldBeTrue();
 }
开发者ID:EddieGarmon,项目名称:GraduatedCylinder,代码行数:18,代码来源:MassOperators.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MasterList类代码示例发布时间:2022-05-24
下一篇:
C# MaskedTextResultHint类代码示例发布时间: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