I am very new to C# and I have to optimize 100's of C# file.The first optimization I have to do is convert String comparison like
if(A == B)
to
if(string.Compare(A, B) == 0)
More complex comparisons are there to convert but this is just a simple example. Is there any ready made solution to perform this mechanical task?A textpad macro will also 开发者_C百科help.
You can use ReSharper with its Pattern matching functionality. I have to note however, that you still would need to apply this quick fix manually to every occurence. You can select the pattern you created in the pattern dialog, click "Search Now" and in the resulting window, uncheck all occurrences you wish not to replace and click "Replace".
Your specific example shouldn't take you more than a few minutes - the time until you figured out how the pattern catalog works ;-)
精彩评论