Yuchao's Blog

C# WriteLine()

2019-10-11

There are two ways to call WriteLine() function in C#.

First solution:

1
2
3
using System;

Consolel.WriteLine("XXXXXX");

Second solution:

1
2
3
using static System.Console;

WriteLine("XXXXXX");

In the second solution, we need to add static in the using directive statement. The reason is Console is a static class inside of System namespace.

More Info: using static

Tags: C#
使用支付宝打赏
使用微信打赏

若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏

扫描二维码,分享此文章