Shortcut to Console command.Writeline in C#, is there?

Asked

Viewed 376 times

0

I know that in Java there is the command "Sout" and then press Backspace and it already generates the line of code.

  • You are using Visual studio?

  • https://stackoverflow.com/questions/9613685/how-to-make-a-shortcut-for-console-writeline

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).

1 answer

1

It makes no sense to have a shortcut in the language. Java doesn’t have it either, it could have it in an IDE and it depends on which one you’re using.

If you are using Visual Studio you can invoke a snippet called cw that just after typing it into the editor and triggering the TAB it expands to what you want.

Note that you can simplify the command with a using static. See more in What is the difference between "using" and "using Static"?.

If none of this fits, you could create code to have a shorter function abstracting the original function. I do not recommend this, and therefore I will not set an example.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.