I need to print doubles so that definite number of symbols (like 8) is allocated for string representation of value. Next words should start at same index from beginning of string in each string. Now I have:
value: 0 test
value: 0.3333333333333 test
value: 0.5 test
I need:
value: 0 test
value: 0.33333333 test
value: 0.5 test
Test code:
double[] ar = new double[] { 0, (double)1 / 3, (double)1 / 2 };
string s = "test";
foreach (var d in ar)
{
Console.WriteLine($"value: {d} {s}");
}
What should I add after {d:
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…