I have update the question for more clarity.
–
Arun SinghJun 12 '12 at 5:38

Works perfectly for me (into Kate), I get the formatting exactly as it originally was. Have you checked your settings in Visual Studio to see if it's not doing some kind of weird stripping of newlines?
–
LattywareJun 12 '12 at 9:45

May i know, what is the reason for downvote?
–
Arun SinghJun 13 '12 at 4:56

Oops, I mixed up the names lol. Well, IDK about @Arjan but I still use "edit" in my posts... I don't think that is any reason to downvote question either, especially from a new user.
–
Alex LockwoodJun 13 '12 at 17:51

(As an aside: the downvote was not mine. And I assume the first downvote was for lack of any detail, but that has meanwhile been E D I T E D into the post ;-))
–
ArjanJun 13 '12 at 17:52

Thanks Alex, If it is an issue with IE8, What should be the next step? Please suggest.
–
Arun SinghJun 13 '12 at 17:55

I can confirm the issues you have, because on my PC there is the same behaviour, if you do the following (using Internet Explorer 7 or 8), you can

reproduce the issue:

Select StackOverflow.com code snippet

Copy it via Ctrl+C

Paste it into Visual Studio via Ctrl+V

After step 3., in the Visual Studio's editor, you lose the formatting of the code. The line breaks are gone.

While I believe this is a bug (most likely of IE, but it could be the code inside of the StackOverflow website as well), I found a

simple workaround:

Select StackOverflow.com code snippet and copy it via Ctrl+C

Open WORDPAD (by typing wordpad in the start menu's command window)

Paste it into the empty WORDPAD window via Ctrl+V

Select the code in WORDPAD via Ctrl+A, then copy it via Ctrl+C

Paste it into Visual Studio via Ctrl+V

Somehow WORDPAD writes the information correctly into the clipboard, so it is transferred later correctly into Visual Studio (important: don't use NOTEPAD, because NOTEPAD can't handle RTF).

Note that Microsoft's MSDN website provides a link button to copy code snippets into the clipboard correctly (for example: click on any of the "copy" links on the page of this link). I'd suggest that this would be a nice feature request for the web site developers of stackoverflow to fix this.