Reputation: 7138
Goal:
In all classes in a particular project, find all constructors which look like this:
public Alert(DBConnection dbConnection, SqlInt32 Alert_ID)
: base (dbConnection, Alert_ID)
{
}
and replace with this:
public Alert(DBConnection dbConnection, SqlInt32 Alert_ID)
: base (dbConnection, Alert_ID)
{
}
protected Alert() {}
protected override Generated.Alert GetNew()
{
return new Alert();
}
I've tried every pattern I can think of in Resharper's Find with Pattern option, but even the simplest expression like: public Alert(DBConnection dbConnection, SqlInt32 Alert_ID)
yields "Nothing found".
Is Resharper incapable of identifying methods/constructors? Can it only find code within them?
Ok - update - this pattern found the matches I want:
public $t$(DBConnection dbConnection) : base(dbConnection)
{
$stmt$
}
So next goal is to insert new methods - like a new public empty constructor.
Trying this replace pattern - but again, no joy:
public $t$(DBConnection dbConnection) : base(dbConnection)
{
$stmt$
}
public $t$() {}
if I try something like
public $t$(DBConnection dbConnection) : base(dbConnection) { $stmt$ //hi }
it works- the comment is inserted. But if I add code outside of the declared search pattern, no such luck...
So now what?
Upvotes: 1
Views: 1385
Reputation: 161783
The following just worked for me:
public WCFTest1Tests()
{
$code$
}
Where $code$ is set to any number of statements.
Upvotes: 2