I've just implemented a custom MessageBox for my application. I'd now like to replace any calls to MessageBox.Show() with my custom implementation, which is MsgBox.Show()**. I realise I could do this with a simple global Find & Replace but I'm wondering if there's a safer/better way to do it with ReSharper?
**all the parameters being passed in are the same in both cases.
There is a tool called Structural search and replace in ReSharper. It is definitely safer to use than a simple Find & Replace, but it is a little bit more complex. I've tried to make an instruction for you, but I didn't test it. Try it on your own risk. Search Google for ReSharper structural search and replace to find more info.
ReSharper | Find | Search with pattern.$t$.Show($args$) in the text field.Add Placeholder -> Expression. Type t for name, then type MessageBox for expression type and choose the correct type from suggestion list.Add Placeholder -> Argument. Type args for name, leave other fields with default values.Find.ReSharper | Find | Search with pattern (your pattern should be still there).Replace.MsgBox.Show($args$).Replace.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With