kunal-chowdhury.com

Do you know that, you can easily copy code from C# Interactive Window?


C# Interactive Window, inside Visual Studio, allows you to test code snippet without compiling the application. It supports several features like syntax highlighting, intellisense and more, and comes with a feature like 'Copy Code', that allows you to copy only the code part from that window.

 

In this quick blog post, we will discuss about the 'Copy Code' functionality part of the C# Interactive Window, inside Visual Studio.

 

Do you know that, you can easily copy code from C# Interactive Window?

 

Using C# Interactive Window, we can do a lot of things to execute our code without compiling the entire application. It allows you to see the output of your code by just entering it in the C# Interactive Window. You can even enter C# using directives inside the window to refer a particular namespace.

 

While you are writing too many lines of code, and executing the output for each entered block, its sometime difficult to copy each one of those blocks into the main code editor. Visual Studio provides a quick function to enable you to copy only the code portion, excluding the outputs.

 

To do this, select the block of lines (basically code and the output), right-click inside the window and click on the 'Copy Code' from the context menu entry. Alternatively, you can press 'CTRL + SHIFT + C' keyboard shortcut. Here's a screenshot of the same for your reference:

 

Do you know that, you can easily copy code from C# Interactive Window?

 

Once the code has been copied to the Clipboard, it will be available to paste in any editor window. Remember that, this feature copies only the code part.

 

Do you know that, you can easily copy code from C# Interactive Window?

 

 



Kunal Chowdhury
If you have come this far, it means that you liked what you are reading (Do you know that, you can easily copy code from C# Interactive Window?).
Why not reach little more and connect with me directly on Twitter, Facebook, Google+ and LinkedIn. I would love to hear your thoughts and opinions on my articles directly.

Don't forget to share your feedback/queries in the comment section below.