我经常写一个 Console.WriteLine 语句,然后在稍后阶段修改它。然后我最终得到这样的陈述。
Console.WriteLine("{2} is not greater than {0} or smaller than {1}",min,max, grade);
Run Code Online (Sandbox Code Playgroud)
有没有办法显式命名传递给 Console.WriteLine 的参数,这样我就不需要按顺序传递 min、max 和 Grade?
作为相关说明,我经常删除要在 Console.WriteLine 中打印的变量,如下所示,其中 {2} 已被删除。
Console.WriteLine("{3} is not greater than {0} or smaller than {1}",min,max, grade);
Run Code Online (Sandbox Code Playgroud)
有没有办法不改变编号并说如下:
Console.WriteLine("{3} is not greater than {0} or smaller than {1}",{0}:min,{1}:max, {3}: grade);
Run Code Online (Sandbox Code Playgroud)
类似于这样的语句
@Html.ActionLink("Your profile", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" });
Run Code Online (Sandbox Code Playgroud)