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

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

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 into 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

DON'T MISS OUT!
Subscribe To Newsletter For your Daily Development Tips and Tricks  

 Best Tips & Tricks on Microsoft Technology Platform 

Invalid email address
We promise not to spam you. You can unsubscribe at any time.
Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

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

Comments are closed.