I often find myself writing something daft like:
String.Format("{1}: {0}", reason, message);
or something similar but with far more string placeholders.
Is there an automated refactoring in ReSharper to change the order of the placeholders and the arguments? I have a tendency to mess up the mapping if I try to change the order by hand.
Obviously, the example above is trivial. What I am doing in reality is often writing something like:
String.Format("{0}.{2} = {1}.{3} AND {0}.{4} = {1}.{5} AND {6}.{7} = {1}.{8}",
table1Alias, table2Alias, col1A, col2A, col1B, col2B, table3Alias, col3C, col2C);
and thinking to myself that it would be great if I could move table3Alias up to the front next to the other aliases.
(ReSharper 7.1.3)
For C# 6+ (ReSharper 10+ / 2016+):
Use string interpolation
Convert to string.Format
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With