Did you know – you can just “copy the code” as well from C# Interactive Window ?

By | July 25, 2017

The Interactive Window in Visual Studio is a great utility to play around the code, language features, API’s and other .NET framework features.   The Interactive Window also support features like IntelliSense, syntax highlighting and navigating through executed commands. Previously we have seen several tips around the C# Interactive Window, but there is one very interesting feature you may overlooked, in fact, I missed that as well.   The Interactive Window, allows you to copy the source code only (Copy Code), so that you can directly paste them back to your main code editor.

Previous Tips related with Interactive Window

Now consider,  inside Interactive Window, you have a set of code snippet along with the output, or other messages.  Of course, you want only the Code part to  take back in the main editor.  At this time, you may select the code block individually, one by one and use regular Copy Option, Or, select all the content and then use “Copy Code” (Ctrl+Shift+C) which will copy only the code related lines in the clipboard.

Copy Code - C# Interactive Window

Copy Code – C# Interactive Window

Related Tip : Did you know – In Visual Studio you can copy multiple code blocks together and paste them one by one ?

If you go back into the main editor, and paste it. You will find only the code lines are in placed.

Copy Code and Paste

Hope this helps

2 thoughts on “Did you know – you can just “copy the code” as well from C# Interactive Window ?

  1. Pingback: Dew Drop - July 25, 2017 (#2527) - Morning Dew

  2. Pingback: Compelling Sunday – 25 Posts on Programming and QA

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Captcha * Time limit is exhausted. Please reload the CAPTCHA.