2

I know C# and I was wondering if there is any built-in commands to output strings other than Console.Write. The reason behind this is CodeGolf.SE, Console.writeLine is too long and I hope there is a shorter command so I can submit some short answers there.

7
  • where you want output string? Commented Jan 5, 2014 at 14:13
  • 2
    Would it be appropriate to create a class-level function to just call Console.Write[Line]()? Commented Jan 5, 2014 at 14:13
  • If only for programmer, use: Debug.WriteLine("string"); or Debug.Write("string"); Commented Jan 5, 2014 at 14:13
  • @PakkuDon changed my question, I was hoping for something short, like cout Commented Jan 5, 2014 at 14:16
  • 1
    There is a specific code-golf site for this kind of nonsense. Commented Jan 5, 2014 at 14:20

3 Answers 3

1

Not a big gain but using the aliasing feature of the using directive

using CL = System.Console
...
CL.WriteLine("Test");

But really it doesn't worth the effort, and not to be recommended in real work projects

Sign up to request clarification or add additional context in comments.

Comments

0

you can use something like this

Action<object> w = Console.Write;

Comments

0

Specifically in CodinGame Clash of Code, you can use Console.Write("xxxx") instead of Console.WriteLine("xxxx") if your answer is only one line. It will save your 4 bytes and validators dont check for the final /n.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.