2简单的C#程序设计.pptVIP

  • 1
  • 0
  • 约 19页
  • 2017-01-06 发布于湖北
  • 举报
2简单的C#程序设计

下面的语句会产生同样的输出: public class TestConsoleApp { ???? public static void Main(string[] args) ???? { ???????? Console.WriteLine(123); ???????? Console.WriteLine({0}, 123); ???????? Console.WriteLine({0:D3}, 123); ???? } } 输出是: 123 123 123 也可以通过String.Format得到同样的输出。 string s = string.Format(123); string t = string.Format({0}, 123); string u = string.Format({0:D3}, 123); Console.WriteLine(s); Console.WriteLine(t); Console.WriteLine(u); 格式化标识符 Standard Numeric Format Specifiers (C) Currency: . . . . . . . . ($123.00) (D) Decimal:. . . . . . . . . -123 (E) Scientific: . . . . . . . -1.234500E+002

文档评论(0)

1亿VIP精品文档

相关文档