Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从指数表示法转换为非指数表示法_C# - Fatal编程技术网

C# 从指数表示法转换为非指数表示法

C# 从指数表示法转换为非指数表示法,c#,C#,我试过: MessageBox.Show(System.Numerics.BigInteger.Parse("7.56e+011", NumberStyles.Float, CultureInfo.InvariantCulture)); 但它仍然显示为7.56e+011 decimal dec = decimal.Parse("7.7583877127496407E-6", System.Globalization.NumberStyl

我试过:

MessageBox.Show(System.Numerics.BigInteger.Parse("7.56e+011",
          NumberStyles.Float,
          CultureInfo.InvariantCulture));
但它仍然显示为7.56e+011

    decimal dec = decimal.Parse("7.7583877127496407E-6", 
    System.Globalization.NumberStyles.Any);
    Console.WriteLine(dec);

您的解决方案再次执行从BigInteger到string的隐式转换,如果指数较大,则使用科学表示法

您正在查看数字格式。你可以用它来做

运行以下代码

为您提供以下消息框


通过将格式更改为{0:F0},您可以不指定小数点。

此代码甚至不会编译。在末尾添加ToString,您将获得75600000000的价值num@Lloydbiginger.Parse7.56e+011,numberstyle.Float,CultureInfo.InvariantCulture.ToString返回756000000000@IlyaIvanov添加ToString会得到相同的结果output@kr13显示完整的编译示例,以及读取输入并生成输出的代码outputs@IlyaIvanov这是我所有的。我正在从文本文件中读取值,需要显示它,例如使用MessageBox,它将无法编译。无法从BigInteger转换为字符串???对我来说很合适。我看不出这将在何处尝试进行隐式转换。@kr13请查看我的编辑。这显示它正在使用您说需要显示的MessageBox
BigInteger num = System.Numerics.BigInteger.Parse("7.56e+011",
      NumberStyles.Float,
      CultureInfo.InvariantCulture);

String text = num.ToString("F5"); // New format string, here with 5 digits. 
string.Format("{0:F}",System.Numerics.BigInteger.Parse("7.56e+011",
          NumberStyles.Float,
          CultureInfo.InvariantCulture))