Visual Studio Find and Replace Regular Expressions help

前端 未结 4 1780
春和景丽
春和景丽 2020-12-24 05:48

I\'d like to replace some assignment statements like:

int someNum = txtSomeNum.Text; 
int anotherNum = txtAnotherNum.Text;

with

<         


        
4条回答
  •  温柔的废话
    2020-12-24 06:27

    I think in Visual Studio, you can mark expressions with curly braces {txtSomeNum.Text}. Then in the replacement, you can refer to it with \1. So the replacement line would be something like Int32.Parse(\1).


    Update: via @Timothy003

    VS 11 does away with the {} \1 syntax and uses () $1

提交回复
热议问题