I have like 30 C# class files that all have the a method with the same name but not the same code inside, I want to change this by searching the C# file for a regex match of the method and whatever is inside. So far my regex can find the first line of the method (thats the easy part) but I cannot figure out how to find the opening curly brace and the closing curly brace with uknown number of characters in between.
Here is my attempt but I'm no expert
private void btnDelete_Click\(object sender, EventArgs e\)
\{
\S
\}
And this is the method I need to find
private void btnDelete_Click(object sender, EventArgs e)
{
if (gridView1.RowCount <= 0) return;
this.rowHandle = gridView1.FocusedRowHandle;
currentState = state.delete;
MessageResult res = new Global.sysMessages.sysMessagesClass().viewMessage(
MessageType.Warning,
"Delete Warning",
"You are about to delete this record from the system forever.\nare you sure you want to continue?",
ButtonTypes.YesNo,
MessageDisplayType.Small);
if (res == MessageResult.Yes)
{
delete(rowHandle);
loadGrid();
}
currentState = state.idle;
}
Any help is welcome, Thanks
