I'm a completely noob and a begginer programmer in C# but I was reading about Roslyn and 'What's new in C# 7.0' and I found something very interesting that I can't find out the answer I need.
In this link, all the examples given contain something like WriteLine("something");
instead of Console.WriteLine("something");
, for example:
public void PrintCoordinates(Point p)
{
p.GetCoordinates(out int x, out int y);
WriteLine($"({x}, {y})");
}
My question is: How can I do that?
Would something like this work?
public static void WriteLine(string v) => Console.WriteLine(v);
Try using static directive:
using static System.Console;
...
WriteLine("some text");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With