You can create an extension method for Environment.NewLine
public static class StringExtensions()
{
public static string ToNL(this string item)
{
return item += Environment.NewLine;
}
}
Now you can use NL(selected because of brevity)
Console.Write("Hello".NL());
Console.Write("World".NL());
writes out:
Hello
World
You can also create an extension method that simply writes something to the console.
public static void cout(this string item)
{
Console.WriteLine(item);
}
And then:
"Hello".cout();
source
share