Format Strings in Console.WriteLine method

前端 未结 3 506
悲&欢浪女
悲&欢浪女 2020-12-02 17:11

Im new to C# programming. Can someone please explain the following code:

Console.WriteLine( \"{0}{1,10}\", \"Face\", \"Frequency\" ); //Headings
Console.Writ         


        
3条回答
  •  温柔的废话
    2020-12-02 18:10

    When you see {x,y}, x represents the argument's index and y the alignment, as specified here. The complete syntax is the following:

    {index[,alignment][:formatString]}
    

提交回复
热议问题