string smth = ""; if(DateTime.Now.Second == 0) smth = null; foreach(char c in smth) { }
In the foreach statement, use the "Check for 'null'" conetxt action on "smth". You get:
string smth = ""; if(DateTime.Now.Second == 0) smth = null; if(smth != null) foreach(char c in smth) { }
After doing Reformat, it becomes:
string smth = ""; if(DateTime.Now.Second == 0) smth = null; if(smth != null) { foreach(char c in smth) { } }
Should look this way right after applying the action.