自学内容网 自学内容网

C#学习3-微软C#官方文档Microsoft-dotnet-csharp.pdf

1.内插表达式的字段宽度和对齐方式

       static void Main(string[] args) {
           var titles = new Dictionary<string, string>() {
               ["Doyle ,Arthur"] = "Hound of the Basker,The",
               ["Lodon ,Jack"] = "Call of the Wild ,The",
               ["Shakesepeare ,William"] = "Tempest,The",
           };
           Console.WriteLine("Author and title List");
           Console.WriteLine();
           Console.WriteLine($"|{"Author",-25}|{"Title",30}|");
           foreach (var title in titles) {
               Console.WriteLine($"|{title.Key,-25}|{title.Value,30}|");
           }
       }

在这里插入图片描述


原文地址:https://blog.csdn.net/qq_42373007/article/details/140439549

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!