开发者

A small java or C# snippet to manipulate text

开发者 https://www.devze.com 2023-03-03 07:22 出处:网络
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

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 ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消