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


C# Percentage.ToString方法代码示例

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


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

示例1: DoubleCtor

 public void DoubleCtor()
 {
     Percentage percentage = new Percentage(0.567);
     Assert.AreEqual(0.567, percentage.Value);
     Assert.AreEqual(0.567, (double) percentage);
     Assert.AreEqual("56.7%", percentage.ToString());
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:7,代码来源:Percentage_Test.cs

示例2: DefaultCtor

 public void DefaultCtor()
 {
     Percentage percentage = new Percentage();
     Assert.AreEqual(0.0, percentage.Value);
     Assert.AreEqual(0.0, (double) percentage);
     Assert.AreEqual("0%", percentage.ToString());
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:7,代码来源:Percentage_Test.cs

示例3: ValidatePercentage

 //---------------------------------------------------------------------
 private void ValidatePercentage(Percentage percentage)
 {
     if (percentage < 0.0 || percentage > 1.0)
         throw new InputValueException(percentage.ToString(),
                                       "Value must be between 0% and 100%");
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:7,代码来源:PoolPercentages.cs

示例4: Check50Percent

 //---------------------------------------------------------------------
 private void Check50Percent(Percentage percentage)
 {
     Assert.AreEqual(0.50, percentage.Value);
     Assert.AreEqual("50%", percentage.ToString());
     Assert.AreEqual("50%", string.Format("{0}", percentage));
     Assert.AreEqual("50%", string.Format("{0:%}", percentage));
     Assert.AreEqual("50.0%", string.Format("{0:#.0%}", percentage));
     Assert.AreEqual(".500", string.Format("{0:#.##0}", percentage));
     Assert.AreEqual(".5", string.Format("{0:#.###}", percentage));
     Assert.AreEqual("0.50", string.Format("{0:0.#0}", percentage));
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:12,代码来源:Percentage_Test.cs

示例5: PercentageMin

 public void PercentageMin()
 {
     Percentage percentage = new Percentage(Percentage.MinValueAsDouble);
     Assert.AreEqual(string.Format("{0}%", double.MinValue),
                     percentage.ToString());
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:6,代码来源:InputVar_Percentage_Test.cs


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