Advertisement
stefanpu

Invalid number format values

Apr 28th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1.             int decimals = -1; // ...или >= 100.
  2.             string format = "{0:F" + decimals + "}";
  3.             Console.WriteLine(format, 12311);
  4.  
  5.             decimals = -1; // ...или >= 100.
  6.             format = "{0:P" + decimals + "}";
  7.             Console.WriteLine(format, 12311);
  8.  
  9.             // Тук не знам какви са невалидните стойности, предполагам че са свързани с буфера на конзолата.
  10.             // Валидно число от тип int, при което се хвърля изключение.
  11.             int totalWidth = -10000000;
  12.             format = "{0," + totalWidth + "}";
  13.             Console.WriteLine(format, 12311);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement