In the below article I will show the process of installing a plugin for Visual Studio which will allow the automatic escaping of double quotes when pasting into a string literal.
When copying Xpath XPath from the Perfecto Object Spy you are copying Xpath XPath which surrounds string values with double quotes (").
And when pasting the Xpath XPath into C# code you must manually change the double quotes to either single quotes or escape the double quotes.
We can solve this using a Visual Studio plugin called: SmartPaster2013
You can read about this plugin here.
To install the plugin from within the IDE first go to Tools->Extensions and Updates
Next click Online->In the search box type SmartPaster2013->In the screen show below the green check box you will see a download button. Click download and follow the prompts.
Finally to use the feature, right click where you wish to paste and select Paste As String Literal
The result of your copy from object spy and paste will look like the below, with the double quotes automatically escaped: