Resharper Code Cleanup force string.empty instead of ""

Hi!

Does anyone know if it's possible to force a string.empty on a code cleanup?

So for example when there are statements like this;

string test = "";

It will be replaced by the code cleanup to this;

string test = string.Empty

If anyone knows if this is possible, I would love to know how to set this up.

 

Thanks,

 

Wouter

0
1 comment

Hello,

 

Thank you for contacting us.

There's ReSharper context action "Use string.Empty", but context actions are not applied during code cleanup.

I'd suggest trying ReSharper | Find | Search with Pattern feature. E.g. finding all

string $name$ = "";

and replacing them with

string $name$ = string.Empty.

Thank you.

0

Please sign in to leave a comment.