WriteLine (" ", argO, argl,..., argN);
WriteLine () , +. : , , . :
{argnum, width: fmt}
argnum , ; width ; fmt . width fmt .
, , argnum. , . width fmt ' . , . , { 0 } , {1} argl ..
.
Console.WriteLine(" {0} {1} .", 28, 29);
.
28 2 9
, 2 8 { 0 }, 2 9 {1}. , , ( 28 2 9). , , , +.
, .
Console.WriteLine(" {0,10} {1,5} .", 28, 29);
.
28 2 9 .
, . , width. , .
, , , . , . .
// .
Using System;
class DisplayOptions { static void Main() { int i;
Console.WriteLine ("^^");
for(i = 1; i < 10; i++)
Console.WriteLine("{0}\t{1}\t{2}", i, i*i, i*i*i);
}
}
.
f
|
|
. . : . , WriteLine(). #, . , , . 10 3.
Console.WriteLine(" 10/3 : {0:#.##}", 10.0/3.0);
.
10/3 : 3.33
#. ## WriteLine () . , , , WriteLine () , .