标签:jpg 其他 library lin 字符 控制 line bubuko www
标识符是一种字符串,用来命名变量、方法、参数和许多后面将要阐述的其他程序结构。
所有C#关键字都由小写字母组成,但是.NET类型名使用Pascal大小写约定。
BCL(Base Class Library,基类库)提供Console类(在System命名空间中),该类包含了输入和输出数据到控制台的方法。
Write
Console.Write("This is trivial text.");
WriteLine
System.Console.WriteLine("This is text1."); System.Console.WriteLine("This is text2."); System.Console.WriteLine("This is text3.");
格式字符串
Console.WriteLine("Two sample integers are {0} and {1}.",3,6);
多重标记和值
Console.WriteLine("Three integers are {1},{0} and {1}.",3,6);
格式化数字字符串
Console.WriteLine("The value:{0}.",500); Console.WriteLine("The value:{0:C}.",500);
对齐说明符
int myInt=500; Console.WriteLine("|{0,10}|",myInt); Console.WriteLine("|{0,-10}|",myInt);
格式字段
double myDouble=12.345678; Console.WriteLine("{0,-10:G}--General", myDouble); Console.WriteLine("{0,-10}--Default,same as General", myDouble); Console.WriteLine("{0,-10:F4}--Fixed Point,4 dec places", myDouble); Console.WriteLine("{0,-10:C}--Currency", myDouble); Console.WriteLine("{0,-10:E3}--Sci.Notation,3 dec places", myDouble); Console.WriteLine("{0,-10:x}--Hexadecimal integer",1194719);
标准数字格式说明符
from: http://www.cnblogs.com/moonache/p/5995909.html
标签:jpg 其他 library lin 字符 控制 line bubuko www
原文地址:https://www.cnblogs.com/GarfieldEr007/p/10126543.html