views:

74

answers:

3

Is there any way to make a "safe" paste into Visual Studio (C#) of HTML code? If I try to paste something like

<div class="user-info"><div class="user-action-time">answered <span title="2010-09-16 02:23:16Z" class="relativetime">21 mins ago</span>

into my code, C# will cry. Using the @ operator doesn't help us, either.

Is it possible to make a special paste in Visual Studio (2010) or Resharper?

Thanks

A: 

You can format the code by "Ctrl KD", see Edit->Advanced->Format Document.

Danny Chen
It has nothing to do with formatting the document, but to make sure strings containing HTML are correctly escaped.
devoured elysium
A: 

Use @, select pasted text and replace " with "" in the selection. That's what I do when I paste text containing quotes.

Alex Paven
A: 

Have you looked at this?

http://www.clipboardfusion.com/

I don't have any personal experience, but it seems like a flexible way to perform any kind of manipulation to the clipboard you like (since you can define transforms in C#) and it's free. As noted by Alex, just doubling up on double-quotes should be fine, providing you preface the string with an '@' and this won't even need any code - just a simple string search / replace.

Bob Sammers