Monthly Archives

5 Articles

Visual Studio Tips

Visual Studio Tip: How to Open the same file twice

Posted by matteskolin on

I recently discovered this feature while working on large MS Word documents. In Word, it is possible to open the same file twice, so that the same document appears in two Windows. This is very helpful when you need to reference one part of the document while you are working on another part of the document elsewhere in the file.

Then when working on a large C# file, I wondered if Visual Studio could do the same thing. It turns out it can! With the large file open, click “New Window” under the Window menu.

See example below. I wasn’t sure how to quickly create a large file, and I didn’t spend much time thinking about it, so it is pretty silly. BigClass.cs contains a method that adds the integer 1 to a list thousands of times. On the right at line 82, I have added an important line that the programmer needs to reference later. On the Left, the programmer is working down on line 7736, and is able to reference line 82 in the window on the right. What else is cool is that if you start typing text in one window, the text appears automatically in the other window.