我想string.Format与optional parameters:
public static void Main(string[] args)
{
// Your code goes here
// Console.WriteLine(string.Format("{0} {1}", "a", "b"));
Console.WriteLine(string.Format("{0} {1}", "a"));
}
Run Code Online (Sandbox Code Playgroud)
例如,参数{1}是可选的并具有默认值
你能帮我做这个吗?
我的 HTML 页面具有以下结构:
<html>
<head></head>
<body>
<nav>
.... navigation menu
</nav>
<div>
<div></div>
<div class="to-print">
<h2>My div to display in print mode<h2>
<section>
<article>....content....</article>
</section>
</div>
<div></div>
</div>
<div>
.... HTML elements
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
如果用户尝试打印页面,我只想打印带有类的 DIV 的内容to-print。我怎样才能做到这一点?