I've been looking all over and can not find a way to find/replace a search term, and also remove the line with it. Here is an example of what I would like
[TestMethod]
[TestCategory("Unit")]
public void Test()
{
}
To
[TestMethod]
public void Test()
{
}
But instead (trying to replace the term with empty), I am getting this, which does make sense, but not what I desire.
[TestMethod]
public void Test()
{
}
How can I remove the line with it?
You can use regular expressions in VS . The following will match the two lines
Search: \\[TestMethod\\]\\r?\\n\\ *\\[TestCategory\\("Unit"\\)\\]
Replace: [TestMethod]
Should do what you want. Note you have to escape the brackets in your search string with \\
you need to brain visual studio 2013, select [TestCategory("Unit")] + the end of [TestMethod]<----here and copy it in FindandReplace.
In cases like this I generally use Sublime Text
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.