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


C# Variable.ToString方法代码示例

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


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

示例1: generalStringFormatTestToolStripMenuItem_Click

        private void generalStringFormatTestToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PrintLine("P E R F O R M I N G   S T R I N G   F O R M A T   T E S T");
            PrintLine("---------------------------------------------------------");
            try
            {
                var U = new Variable();
                var V = new Variable("V", "0");
                var F1 = new Value(1.0 / 3.0);
                var F2 = new Value(2.0 / 5.0);

                PrintLine("DEFAULT:");
                PrintLine("1/3 => " + F1.ToString(), Color.Blue);
                PrintLine("2/5 => " + F2.ToString(), Color.Blue);
                PrintLine("x => " + x.ToString(), Color.Blue);
                PrintLine("U => " + U.ToString(), Color.Blue);
                PrintLine("V_0 => " + V.ToString(), Color.Blue);
                PrintLine("i => " + i.ToString(), Color.Blue);
                PrintLine("C => " + C.ToString(), Color.Blue);
                PrintLine("x + y => " + (x + y).ToString(), Color.Blue);
                PrintLine("x - y => " + (x - y).ToString(), Color.Blue);
                PrintLine("x * y => " + (x * y).ToString(), Color.Blue);
                PrintLine("x / y => " + (x / y).ToString(), Color.Blue);
                PrintLine("x ^ y => " + (x ^ y).ToString(), Color.Blue);
                PrintLine("PARSE FRIENDLY:");
                PrintLine("1/3 => " + F1.ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("2/5 => " + F2.ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("x => " + x.ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("U => " + U.ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("V_0 => " + V.ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("i => " + i.ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("C => " + C.ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("x + y => " + (x + y).ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("x - y => " + (x - y).ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("x * y => " + (x * y).ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("x / y => " + (x / y).ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("x ^ y => " + (x ^ y).ToString(ExpressionStringFormat.ParseFriendly), Color.Blue);
                PrintLine("LATEX:");
                PrintLine("1/3 => " + F1.ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("2/5 => " + F2.ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("x => " + x.ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("U => " + U.ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("V_0 => " + V.ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("i => " + i.ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("C => " + C.ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("x + y => " + (x + y).ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("x - y => " + (x - y).ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("x * y => " + (x * y).ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("x / y => " + (x / y).ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("x ^ y => " + (x ^ y).ToString(ExpressionStringFormat.LaTeX), Color.Blue);
                PrintLine("SUCCESS", Color.Green);
            }
            catch (Exception ex)
            {
                PrintLine(ex.Message, Color.Red);
            }
            PrintLine();
        }
开发者ID:HarrisonTotty,项目名称:Simplex.Math,代码行数:58,代码来源:MainForm.cs

示例2: TestToString

 public void TestToString()
 {
     var v = new Variable(new uint[] {1, 3, 6});
     Assert.AreEqual("Variable: Id: .1.3.6; Data: Null", v.ToString());
 }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:5,代码来源:VariableTestFixture.cs

示例3: CreateName

        private static string CreateName(Variable<GaussianDistribution> sumVariable,
            IList<Variable<GaussianDistribution>> variablesToSum, double[] weights)
        {
            var sb = new StringBuilder();
            sb.Append(sumVariable.ToString());
            sb.Append(" = ");
            for (int i = 0; i < variablesToSum.Count; i++)
            {
                bool isFirst = (i == 0);

                if (isFirst && (weights[i] < 0))
                {
                    sb.Append("-");
                }

                sb.Append(Math.Abs(weights[i]).ToString("0.00"));
                sb.Append("*[");
                sb.Append(variablesToSum[i]);
                sb.Append("]");

                bool isLast = (i == variablesToSum.Count - 1);

                if (!isLast)
                {
                    if (weights[i + 1] >= 0)
                    {
                        sb.Append(" + ");
                    }
                    else
                    {
                        sb.Append(" - ");
                    }
                }
            }

            return sb.ToString();
        }
开发者ID:vmendi,项目名称:UnusualEngine,代码行数:37,代码来源:GaussianWeightedSumFactor.cs

示例4: VariableInfo

 private VariableInfo(bool isRelObject, Variable name, string value)
 {
     this.name = string.Format("{0}{1}", isRelObject ? "Rel" : "", name.ToString());
     this.value = value;
 }
开发者ID:0anion0,项目名称:IBN,代码行数:5,代码来源:AlertVariable.cs


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