我经常写一个Console.WriteLine语句,然后在以后修改它。然后我就会得到这样的语句。
Console.WriteLine("{2} is not greater than {0} or smaller than {1}",min,max, grade);
有没有一种方法可以明确地命名传递给Console.WriteLine的参数,以便我不需要按顺序传递min、max和grade?
另外,我经常在Console.WriteLine中删除要打印的变量,例如下面的示例,其中{2}已被删除。
Console.WriteLine("{3} is not greater than {0} or smaller than {1}",min,max, grade);
有没有不改变编号的方法,可以这样说:
Console.WriteLine("{3} is not greater than {0} or smaller than {1}",{0}:min,{1}:max, {3}: grade);
类似于这样的语句
@Html.ActionLink("Your profile", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" });
$"{grade}不是更大的..."
。 - CodeCaster