C# Winform | Parse, Convert - System.FormatException
System.FormatException - 입력 문자열의 형식이 잘못되었습니다.
1. 원인
scientific notation - 과학적 표기법
Test Code
E- Parse, Convert Exception
string data = "1.7521E-06";
decimal data_Convert = Convert.ToDecimal(data);
decimal data_Parse = decimal.Parse(data);
|
cs |
RESULT
해결방법
https://docs.microsoft.com/ko-kr/dotnet/api/system.globalization.numberstyles?view=netcore-3.1
Test Code
string data = "1.7521E-06";
decimal data_Parse = decimal.Parse(data, System.Globalization.NumberStyles.Float);
Console.WriteLine(data_Parse);
|
cs |
RESULT
'C# Winform' 카테고리의 다른 글
C# Winform | WebView / Tradingview - Chart (widget) (0) | 2020.10.16 |
---|---|
C# Winform | Pie Chart | Angle, Label (0) | 2020.09.02 |
C# Winform | Json - Read, Write (0) | 2020.08.24 |
C# Winform | List Sort | ObservableCollection Sort (0) | 2020.07.03 |
C# Winform | enum foreach (0) | 2020.05.06 |