sujeshva
asked on
Regular Expression Find and Replace in Visual Studio 2003
Hey Experts,
Quick and simple question.
I have multiple code files where the Finally block in each method has an object.Dispose().. like this
Finally
x.Dispose()
Y.Dispose()
End Try
x and y can vary in names based on what object is being disposed. I want to do a Find and Replace in the entire solution where I have to find a match for Any object.Dispose() and replace it with
If Not Object is Nothing Then
Object.Dispose()
End If
i.e
The code will be something like
objSQL.Dispose or lobjSQL.Dispose() or objOracle.Dispose() and I have to replace them with
If not objectname Is Nothing Then
objectname.Dispose()
End If
where objectname could be anything that I match with a single Regular expression and use that in the replace too..
Any ideas or thoughts or the expression itself is appreciated.
Thanks,
Suj
Quick and simple question.
I have multiple code files where the Finally block in each method has an object.Dispose().. like this
Finally
x.Dispose()
Y.Dispose()
End Try
x and y can vary in names based on what object is being disposed. I want to do a Find and Replace in the entire solution where I have to find a match for Any object.Dispose() and replace it with
If Not Object is Nothing Then
Object.Dispose()
End If
i.e
The code will be something like
objSQL.Dispose or lobjSQL.Dispose() or objOracle.Dispose() and I have to replace them with
If not objectname Is Nothing Then
objectname.Dispose()
End If
where objectname could be anything that I match with a single Regular expression and use that in the replace too..
Any ideas or thoughts or the expression itself is appreciated.
Thanks,
Suj
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
If not \1 Is Nothing Then
\1.Dispose()
End If